diff options
author | Karel Kočí <cynerd@email.cz> | 2018-01-05 18:14:53 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-01-05 18:14:53 +0100 |
commit | 71e2e98d07499c6d0f31596fec52cd8cef5813a9 (patch) | |
tree | d2aa2729956464f2aab62bb5f088850b69a5a8d7 /qtmips_machine/memory.cpp | |
parent | 1a3fbaf22975b1f130998841adb3109b8a543513 (diff) | |
download | qtmips-71e2e98d07499c6d0f31596fec52cd8cef5813a9.tar.gz qtmips-71e2e98d07499c6d0f31596fec52cd8cef5813a9.tar.bz2 qtmips-71e2e98d07499c6d0f31596fec52cd8cef5813a9.zip |
Implement machine restart
Diffstat (limited to 'qtmips_machine/memory.cpp')
-rw-r--r-- | qtmips_machine/memory.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/qtmips_machine/memory.cpp b/qtmips_machine/memory.cpp index 142c750..69f7d54 100644 --- a/qtmips_machine/memory.cpp +++ b/qtmips_machine/memory.cpp @@ -178,6 +178,16 @@ Memory::~Memory() { free_section_tree(this->mt_root, 0); } +void Memory::reset() { + free_section_tree(this->mt_root, 0); + this->mt_root = allocate_section_tree(); +} + +void Memory::reset(const Memory &m) { + free_section_tree(this->mt_root, 0); + this->mt_root = copy_section_tree(m.get_memorytree_root(), 0); +} + // Create address mask with section length #define ADDRESS_MASK(LEN) ((1 << (LEN)) - 1) |