From 16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 6 Feb 2019 15:14:26 +0100 Subject: Provide at least partial cleanup after QtMipsMachine. Signed-off-by: Pavel Pisa --- qtmips_machine/qtmipsmachine.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'qtmips_machine/qtmipsmachine.cpp') 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; } -- cgit v1.2.3