diff --git a/src/xenia/cpu/ppc/testing/ppc_testing_main.cc b/src/xenia/cpu/ppc/testing/ppc_testing_main.cc index c3c56cd6b..7a05ec5eb 100644 --- a/src/xenia/cpu/ppc/testing/ppc_testing_main.cc +++ b/src/xenia/cpu/ppc/testing/ppc_testing_main.cc @@ -176,10 +176,6 @@ class TestRunner { memory_size = 64 * 1024 * 1024; memory.reset(new Memory()); memory->Initialize(); - - processor.reset(new Processor(memory.get(), nullptr, nullptr)); - processor->Setup(); - processor->set_debug_info_flags(DebugInfoFlags::kDebugInfoAll); } ~TestRunner() { @@ -189,6 +185,14 @@ class TestRunner { } bool Setup(TestSuite& suite) { + // Reset memory. + memory->Reset(); + + // Setup a fresh processor. + processor.reset(new Processor(memory.get(), nullptr, nullptr)); + processor->Setup(); + processor->set_debug_info_flags(DebugInfoFlags::kDebugInfoAll); + // Load the binary module. auto module = std::make_unique(processor.get()); if (!module->LoadFile(START_ADDRESS, suite.bin_file_path)) { @@ -417,12 +421,12 @@ bool RunTests(const std::wstring& test_name) { return false; } + TestRunner runner; for (auto& test_suite : test_suites) { XELOGI("%ls.s:", test_suite.name.c_str()); for (auto& test_case : test_suite.test_cases) { XELOGI(" - %s", test_case.name.c_str()); - TestRunner runner; ProtectedRunTest(test_suite, runner, test_case, failed_count, passed_count); } diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 520d6b4ce..fc9722f01 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -270,6 +270,10 @@ void Memory::UnmapViews() { } } +void Memory::Reset() { + // TODO(benvanik): zero memory, free all heap page tables, etc. +} + BaseHeap* Memory::LookupHeap(uint32_t address) { if (address < 0x40000000) { return &heaps_.v00000000; diff --git a/src/xenia/memory.h b/src/xenia/memory.h index f24c7a99c..3b5c59f5c 100644 --- a/src/xenia/memory.h +++ b/src/xenia/memory.h @@ -226,6 +226,9 @@ class Memory { // mapping to the file system fails. bool Initialize(); + // Resets all memory to zero and resets all allocations. + void Reset(); + // Full file name and path of the memory-mapped file backing all memory. const std::wstring& file_name() const { return file_name_; }