diff --git a/src/xenia/cpu/backend/x64/x64_code_cache.cc b/src/xenia/cpu/backend/x64/x64_code_cache.cc index 41dac0ac9..539d3f359 100644 --- a/src/xenia/cpu/backend/x64/x64_code_cache.cc +++ b/src/xenia/cpu/backend/x64/x64_code_cache.cc @@ -37,10 +37,10 @@ X64CodeCache::~X64CodeCache() { RtlDeleteGrowableFunctionTable(unwind_table_handle_); } if (indirection_table_base_) { - VirtualFree(indirection_table_base_, kIndirectionTableSize, MEM_RELEASE); + VirtualFree(indirection_table_base_, 0, MEM_RELEASE); } if (generated_code_base_) { - VirtualFree(generated_code_base_, kIndirectionTableSize, MEM_RELEASE); + VirtualFree(generated_code_base_, 0, MEM_RELEASE); } } diff --git a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.bin b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.bin index aac45e6a6..1049c8f97 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.bin and b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.dis b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.dis index c58eb2a96..1cb2aac76 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.dis @@ -37,3 +37,14 @@ Disassembly of section .text: 10004c: 54 a5 f8 7e rlwinm r5,r5,31,1,31 100050: 7c a6 00 34 cntlzw r6,r5 100054: 4e 80 00 20 blr + +0000000000100058 : + 100058: 7c a6 00 34 cntlzw r6,r5 + 10005c: 4e 80 00 20 blr + +0000000000100060 : + 100060: 38 a0 ff ff li r5,-1 + 100064: 78 a5 07 c6 rldicr r5,r5,32,31 + 100068: 38 a5 00 01 addi r5,r5,1 + 10006c: 7c a6 00 34 cntlzw r6,r5 + 100070: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.map b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.map index 884445add..e1044091f 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_cntlzw.map +++ b/src/xenia/cpu/frontend/test/bin/instr_cntlzw.map @@ -6,3 +6,5 @@ 0000000000000030 t test_cntlzw_3_constant 0000000000000040 t test_cntlzw_4 0000000000000048 t test_cntlzw_4_constant +0000000000000058 t test_cntlzw_5 +0000000000000060 t test_cntlzw_5_constant diff --git a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc index b06eefb1b..8e7c20fd7 100644 --- a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc +++ b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc @@ -35,7 +35,7 @@ using xe::cpu::Runtime; typedef std::vector> AnnotationList; -const uint32_t START_ADDRESS = 0x100000; +const uint32_t START_ADDRESS = 0x80000000; struct TestCase { TestCase(uint32_t address, std::string& name) @@ -194,6 +194,9 @@ class TestRunner { } processor->AddModule(std::move(module)); + processor->backend()->CommitExecutableRange(START_ADDRESS, + START_ADDRESS + 1024 * 1024); + // Simulate a thread. uint32_t stack_size = 64 * 1024; uint32_t stack_address = START_ADDRESS - stack_size; diff --git a/src/xenia/cpu/test/util.h b/src/xenia/cpu/test/util.h index 1a9d279e3..75200c269 100644 --- a/src/xenia/cpu/test/util.h +++ b/src/xenia/cpu/test/util.h @@ -47,12 +47,13 @@ class TestFunction { for (auto& processor : processors) { auto module = std::make_unique( processor.get(), "Test", - [](uint64_t address) { return address == 0x1000; }, + [](uint64_t address) { return address == 0x80000000; }, [generator](hir::HIRBuilder& b) { generator(b); return true; }); processor->AddModule(std::move(module)); + processor->backend()->CommitExecutableRange(0x80000000, 0x80010000); } } @@ -65,7 +66,7 @@ class TestFunction { std::function post_call) { for (auto& processor : processors) { xe::cpu::Function* fn; - processor->ResolveFunction(0x1000, &fn); + processor->ResolveFunction(0x80000000, &fn); uint32_t stack_size = 64 * 1024; uint32_t stack_address = memory_size - stack_size; diff --git a/xb.bat b/xb.bat index b43d39edb..ba40cd9c8 100644 --- a/xb.bat +++ b/xb.bat @@ -299,7 +299,7 @@ FOR %%G in (*.s) DO ( REM Eat the first 4 lines to kill the file path that'll differ across machines. MORE +4 %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp > %TEST_BIN_WIN%\!SRC_NAME!.dis DEL %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp - %PPC_LD% -A powerpc:common64 -melf64ppc -EB -nostdlib --oformat binary -Ttext 0x100000 -e 0x100000 -o %TEST_BIN%/!SRC_NAME!.bin !OBJ_FILE! + %PPC_LD% -A powerpc:common64 -melf64ppc -EB -nostdlib --oformat binary -Ttext 0x80000000 -e 0x80000000 -o %TEST_BIN%/!SRC_NAME!.bin !OBJ_FILE! IF !ERRORLEVEL! NEQ 0 ( SET ANY_ERRORS=1 )