From ef75e3cdd1a7678b1ee726d29a42a871bf39da33 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Tue, 5 Jan 2021 14:36:15 +0100 Subject: JIT A64: fixes also update Switch code for latest libnx --- src/ARMJIT_A64/ARMJIT_Compiler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ARMJIT_A64/ARMJIT_Compiler.cpp') diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp index 5fe3fe7..880a6fc 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp @@ -187,7 +187,8 @@ Compiler::Compiler() JitRWBase = aligned_alloc(0x1000, JitMemSize); JitRXStart = (u8*)&__start__ - JitMemSize - 0x1000; - JitRWStart = virtmemReserve(JitMemSize); + virtmemLock(); + JitRWStart = virtmemFindAslr(JitMemSize, 0x1000); MemoryInfo info = {0}; u32 pageInfo = {0}; int i = 0; @@ -214,6 +215,8 @@ Compiler::Compiler() succeded = R_SUCCEEDED(svcMapProcessMemory(JitRWStart, envGetOwnProcessHandle(), (u64)JitRXStart, JitMemSize)); assert(succeded); + virtmemUnlock(); + SetCodeBase((u8*)JitRWStart, (u8*)JitRXStart); JitMemMainSize = JitMemSize; #else @@ -426,7 +429,6 @@ Compiler::~Compiler() { bool succeded = R_SUCCEEDED(svcUnmapProcessMemory(JitRWStart, envGetOwnProcessHandle(), (u64)JitRXStart, JitMemSize)); assert(succeded); - virtmemFree(JitRWStart, JitMemSize); succeded = R_SUCCEEDED(svcUnmapProcessCodeMemory(envGetOwnProcessHandle(), (u64)JitRXStart, (u64)JitRWBase, JitMemSize)); assert(succeded); free(JitRWBase); @@ -753,7 +755,8 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[] FixupBranch skipNop = B(); SetJumpTarget(skipExecute); - Comp_AddCycles_C(); + if (IrregularCycles) + Comp_AddCycles_C(true); Comp_BranchSpecialBehaviour(false); -- cgit v1.2.3