apply fixes for aarch64 linux by @nadiaholmquist

This commit is contained in:
RSDuck 2020-02-04 18:33:05 +01:00
parent 99b34efe2d
commit 0d83e98e04
3 changed files with 17 additions and 2 deletions

View File

@ -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++)

View File

@ -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"

View File

@ -8,7 +8,6 @@
#include <functional>
#include "ArmCommon.h"
#include "Assert.h"
#include "BitSet.h"
#include "Compat.h"