aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2020-02-04 18:33:05 +0100
committerRSDuck <rsduck@users.noreply.github.com>2020-06-16 11:57:52 +0200
commit0d83e98e04548eb7b860df53be0a76e9ecb0809b (patch)
tree7afecef731d930f9f867aed0b7a791737534bdc4
parent99b34efe2d923c4fd6fbfdb051833d2af6ea2136 (diff)
apply fixes for aarch64 linux by @nadiaholmquist
-rw-r--r--src/ARMJIT_A64/ARMJIT_Compiler.cpp16
-rw-r--r--src/dolphin/Arm64Emitter.cpp2
-rw-r--r--src/dolphin/Arm64Emitter.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp
index 89d0029..b598ac8 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 <sys/mman.h>
+#include <unistd.h>
#endif
#include <malloc.h>
@@ -34,6 +37,9 @@ template <>
const int RegisterCache<Compiler, ARM64Reg>::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 dbcf425..dd2416b 100644
--- a/src/dolphin/Arm64Emitter.cpp
+++ b/src/dolphin/Arm64Emitter.cpp
@@ -8,9 +8,9 @@
#include <cstring>
#include <vector>
+#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 4cb9ff7..3d9d4ba 100644
--- a/src/dolphin/Arm64Emitter.h
+++ b/src/dolphin/Arm64Emitter.h
@@ -8,7 +8,6 @@
#include <functional>
#include "ArmCommon.h"
-#include "Assert.h"
#include "BitSet.h"
#include "Compat.h"