aligned_alloc instead of memalign
also carry over new Switch changes
This commit is contained in:
parent
d2cfd71c32
commit
49b5860f0f
|
@ -1,5 +1,11 @@
|
|||
#include "ARMJIT_Compiler.h"
|
||||
|
||||
#include "../ARMJIT_Internal.h"
|
||||
#include "../ARMInterpreter.h"
|
||||
#include "../Config.h"
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#include "../switch/compat_switch.h"
|
||||
#include <switch.h>
|
||||
|
||||
extern char __start__;
|
||||
#else
|
||||
|
@ -7,13 +13,7 @@ extern char __start__;
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "ARMJIT_Compiler.h"
|
||||
|
||||
#include "../ARMJIT_Internal.h"
|
||||
#include "../ARMInterpreter.h"
|
||||
#include "../Config.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace Arm64Gen;
|
||||
|
||||
|
@ -184,7 +184,7 @@ void Compiler::PopRegs(bool saveHiRegs)
|
|||
Compiler::Compiler()
|
||||
{
|
||||
#ifdef __SWITCH__
|
||||
JitRWBase = memalign(0x1000, JitMemSize);
|
||||
JitRWBase = aligned_alloc(0x1000, JitMemSize);
|
||||
|
||||
JitRXStart = (u8*)&__start__ - JitMemSize - 0x1000;
|
||||
JitRWStart = virtmemReserve(JitMemSize);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#if defined(__SWITCH__)
|
||||
#include "switch/compat_switch.h"
|
||||
#include <switch.h>
|
||||
#include "frontend/switch/FaultHandler.h"
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
|
@ -28,9 +29,7 @@
|
|||
#include "NDSCart.h"
|
||||
#include "SPU.h"
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
We're handling fastmem here.
|
||||
|
@ -97,22 +96,14 @@ void __libnx_exception_handler(ThreadExceptionDump* ctx)
|
|||
integerRegisters[31] = ctx->sp.x;
|
||||
integerRegisters[32] = ctx->pc.x;
|
||||
|
||||
if (ARMJIT_Memory::FaultHandler(desc, offset))
|
||||
if (ARMJIT_Memory::FaultHandler(desc))
|
||||
{
|
||||
integerRegisters[32] = (u64)desc.FaultPC;
|
||||
|
||||
ARM_RestoreContext(integerRegisters);
|
||||
}
|
||||
|
||||
if (ctx->pc.x >= (u64)&__start__ && ctx->pc.x < (u64)&__rodata_start)
|
||||
{
|
||||
printf("unintentional fault in .text at 0x%x (type %d) (trying to access 0x%x?)\n",
|
||||
ctx->pc.x - (u64)&__start__, ctx->error_desc, ctx->far.x);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("unintentional fault somewhere in deep (address) space at %x (type %d)\n", ctx->pc.x, ctx->error_desc);
|
||||
}
|
||||
HandleFault(ctx->pc.x, ctx->lr.x, ctx->fp.x, ctx->far.x, ctx->error_desc);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -670,12 +661,12 @@ bool FaultHandler(FaultDescription& faultDesc)
|
|||
return false;
|
||||
}
|
||||
|
||||
const u64 AddrSpaceSize = 0x100000000;
|
||||
|
||||
void Init()
|
||||
{
|
||||
const u64 AddrSpaceSize = 0x100000000;
|
||||
|
||||
#if defined(__SWITCH__)
|
||||
MemoryBase = (u8*)memalign(0x1000, MemoryTotalSize);
|
||||
MemoryBase = (u8*)aligned_alloc(0x1000, MemoryTotalSize);
|
||||
MemoryBaseCodeMem = (u8*)virtmemReserve(MemoryTotalSize);
|
||||
|
||||
bool succeded = R_SUCCEEDED(svcMapProcessCodeMemory(envGetOwnProcessHandle(), (u64)MemoryBaseCodeMem,
|
||||
|
|
Loading…
Reference in New Issue