aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);