From 0d83e98e04548eb7b860df53be0a76e9ecb0809b Mon Sep 17 00:00:00 2001 From: RSDuck Date: Tue, 4 Feb 2020 18:33:05 +0100 Subject: [PATCH] apply fixes for aarch64 linux by @nadiaholmquist --- src/ARMJIT_A64/ARMJIT_Compiler.cpp | 16 ++++++++++++++++ src/dolphin/Arm64Emitter.cpp | 2 +- src/dolphin/Arm64Emitter.h | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp index 89d00298..b598ac81 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp @@ -8,6 +8,9 @@ #include "../switch/compat_switch.h" extern char __start__; +#else +#include +#include #endif #include @@ -34,6 +37,9 @@ template <> const int RegisterCache::NativeRegsAvailable = 8; const int JitMemSize = 16 * 1024 * 1024; +#ifndef __SWITCH__ +u8 JitMem[JitMemSize]; +#endif void Compiler::MovePC() { @@ -76,6 +82,16 @@ Compiler::Compiler() SetCodeBase((u8*)JitRWStart, (u8*)JitRXStart); JitMemUseableSize = JitMemSize; Reset(); +#else + #else + u64 pageSize = sysconf(_SC_PAGE_SIZE); + u8* pageAligned = (u8*)(((u64)JitMem & ~(pageSize - 1)) + pageSize); + u64 alignedSize = (((u64)JitMem + sizeof(JitMem)) & ~(pageSize - 1)) - (u64)pageAligned; + mprotect(pageAligned, alignedSize, PROT_EXEC | PROT_READ | PROT_WRITE); + + SetCodeBase(pageAligned, pageAligned); + JitMemUseableSize = alignedSize; + Reset(); #endif for (int i = 0; i < 3; i++) diff --git a/src/dolphin/Arm64Emitter.cpp b/src/dolphin/Arm64Emitter.cpp index dbcf4257..dd2416ba 100644 --- a/src/dolphin/Arm64Emitter.cpp +++ b/src/dolphin/Arm64Emitter.cpp @@ -8,9 +8,9 @@ #include #include +#include "Compat.h" #include "Align.h" #include "Arm64Emitter.h" -#include "Assert.h" #include "BitUtils.h" #include "../types.h" #include "MathUtil.h" diff --git a/src/dolphin/Arm64Emitter.h b/src/dolphin/Arm64Emitter.h index 4cb9ff7c..3d9d4ba2 100644 --- a/src/dolphin/Arm64Emitter.h +++ b/src/dolphin/Arm64Emitter.h @@ -8,7 +8,6 @@ #include #include "ArmCommon.h" -#include "Assert.h" #include "BitSet.h" #include "Compat.h"