aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-06 15:14:26 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-06 15:14:26 +0100
commit16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761 (patch)
tree3fd7d4932eb1f77c2f2268a0f393e87b0a54d6e7
parent608eed5c16366cae251f5d12ad1ed0b988b3ce46 (diff)
downloadqtmips-16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761.tar.gz
qtmips-16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761.tar.bz2
qtmips-16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761.zip
Provide at least partial cleanup after QtMipsMachine.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r--qtmips_machine/qtmipsmachine.cpp29
-rw-r--r--qtmips_machine/qtmipsmachine.h1
2 files changed, 29 insertions, 1 deletions
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp
index 0f65609..b691645 100644
--- a/qtmips_machine/qtmipsmachine.cpp
+++ b/qtmips_machine/qtmipsmachine.cpp
@@ -55,7 +55,7 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) {
physaddrspace = new PhysAddrSpace();
physaddrspace->insert_range(mem, 0x00000000, 0xefffffff, false);
MemoryAccess *periph = new SimplePeripheral();
- physaddrspace->insert_range(periph, 0xffffc000, 0xffffcfff, false);
+ physaddrspace->insert_range(periph, 0xffffc000, 0xffffcfff, true);
cpu_mem = physaddrspace;
#endif
cch_program = new Cache(cpu_mem, &cc.cache_program(), cc.memory_access_time_read(), cc.memory_access_time_write());
@@ -71,6 +71,33 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) {
connect(run_t, SIGNAL(timeout()), this, SLOT(step()));
}
+QtMipsMachine::~QtMipsMachine() {
+ if (run_t != nullptr)
+ delete run_t;
+ run_t = nullptr;
+ if (cr != nullptr)
+ delete cr;
+ cr = nullptr;
+ if (regs != nullptr)
+ delete regs;
+ regs = nullptr;
+ if (mem != nullptr)
+ delete mem;
+ mem = nullptr;
+ if (cch_program != nullptr)
+ delete cch_program;
+ cch_program = nullptr;
+ if (cch_data != nullptr)
+ delete cch_data;
+ cch_data = nullptr;
+ if (physaddrspace != nullptr)
+ delete physaddrspace;
+ physaddrspace = nullptr;
+ if (mem_program_only != nullptr)
+ delete mem_program_only;
+ mem_program_only = nullptr;
+}
+
const MachineConfig &QtMipsMachine::config() {
return mcnf;
}
diff --git a/qtmips_machine/qtmipsmachine.h b/qtmips_machine/qtmipsmachine.h
index fd7dadf..48dc786 100644
--- a/qtmips_machine/qtmipsmachine.h
+++ b/qtmips_machine/qtmipsmachine.h
@@ -54,6 +54,7 @@ class QtMipsMachine : public QObject {
Q_OBJECT
public:
QtMipsMachine(const MachineConfig &cc);
+ ~QtMipsMachine();
const MachineConfig &config();
void set_speed(unsigned);