aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_machine/memory.cpp')
-rw-r--r--qtmips_machine/memory.cpp10
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)