Fixes for android, cleanup context.cpp
This commit is contained in:
parent
03914309e3
commit
6547d80095
|
@ -600,6 +600,7 @@ void _vmem_bm_reset()
|
|||
#if HOST_OS==OS_WINDOWS
|
||||
VirtualFree(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MEM_DECOMMIT);
|
||||
#else
|
||||
mprotect(p_sh4rcb, sizeof(p_sh4rcb->fpcb), PROT_NONE);
|
||||
madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_DONTNEED);
|
||||
#ifdef MADV_REMOVE
|
||||
madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_REMOVE);
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
#define MCTX(p) (((ucontext_t *)(segfault_ctx))->uc_mcontext p)
|
||||
template <typename Ta, typename Tb>
|
||||
void swap(Ta& a, Tb& b, bool reverse) {
|
||||
if (reverse) {
|
||||
b = a;
|
||||
void bicopy(Ta& rei, Tb& seg, bool to_segfault) {
|
||||
if (to_segfault) {
|
||||
seg = rei;
|
||||
}
|
||||
else {
|
||||
a = b;
|
||||
rei = seg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,36 +29,36 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
|
|||
|
||||
#if HOST_CPU == CPU_ARM
|
||||
#if HOST_OS == OS_LINUX
|
||||
swap(reictx->pc, MCTX(.arm_pc), to_segfault);
|
||||
bicopy(reictx->pc, MCTX(.arm_pc), to_segfault);
|
||||
u32* r =(u32*) &MCTX(.arm_r0);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
swap(reictx->r[i], r[i], to_segfault);
|
||||
bicopy(reictx->r[i], r[i], to_segfault);
|
||||
|
||||
#elif HOST_OS == OS_DARWIN
|
||||
swap(reictx->pc, MCTX(->__ss.__pc), to_segfault);
|
||||
bicopy(reictx->pc, MCTX(->__ss.__pc), to_segfault);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
swap(reictx->r[i], MCTX(->__ss.__r[i]), to_segfault);
|
||||
bicopy(reictx->r[i], MCTX(->__ss.__r[i]), to_segfault);
|
||||
#else
|
||||
#error HOST_OS
|
||||
#endif
|
||||
#elif HOST_CPU == CPU_X86
|
||||
#if HOST_OS == OS_LINUX
|
||||
swap(reictx->pc, MCTX(.gregs[REG_EIP]), to_segfault);
|
||||
swap(reictx->esp, MCTX(.gregs[REG_ESP]), to_segfault);
|
||||
swap(reictx->eax, MCTX(.gregs[REG_EAX]), to_segfault);
|
||||
swap(reictx->ecx, MCTX(.gregs[REG_ECX]), to_segfault);
|
||||
bicopy(reictx->pc, MCTX(.gregs[REG_EIP]), to_segfault);
|
||||
bicopy(reictx->esp, MCTX(.gregs[REG_ESP]), to_segfault);
|
||||
bicopy(reictx->eax, MCTX(.gregs[REG_EAX]), to_segfault);
|
||||
bicopy(reictx->ecx, MCTX(.gregs[REG_ECX]), to_segfault);
|
||||
#elif HOST_OS == OS_DARWIN
|
||||
swap(reictx->pc, MCTX(->__ss.__eip), to_segfault);
|
||||
swap(reictx->esp, MCTX(->__ss.__esp), to_segfault);
|
||||
swap(reictx->eax, MCTX(->__ss.__eax), to_segfault);
|
||||
swap(reictx->ecx, MCTX(->__ss.__ecx), to_segfault);
|
||||
bicopy(reictx->pc, MCTX(->__ss.__eip), to_segfault);
|
||||
bicopy(reictx->esp, MCTX(->__ss.__esp), to_segfault);
|
||||
bicopy(reictx->eax, MCTX(->__ss.__eax), to_segfault);
|
||||
bicopy(reictx->ecx, MCTX(->__ss.__ecx), to_segfault);
|
||||
#else
|
||||
#error HOST_OS
|
||||
#endif
|
||||
#elif HOST_CPU == CPU_MIPS
|
||||
swap(reictx->pc, MCTX(.pc), to_segfault);
|
||||
bicopy(reictx->pc, MCTX(.pc), to_segfault);
|
||||
#else
|
||||
#error Unsupported HOST_CPU
|
||||
#endif
|
||||
|
|
|
@ -170,9 +170,9 @@ int dc_init(int argc,wchar* argv[])
|
|||
int rv= 0;
|
||||
|
||||
|
||||
if (settings.bios.UseReios || !LoadRomFiles(GetPath("/data/")) && !LoadRomFiles(GetPath("/")))
|
||||
if (settings.bios.UseReios || !LoadRomFiles(GetPath("/data/")))
|
||||
{
|
||||
if (!LoadHle(GetPath("/data/")) || !LoadHle(GetPath("/")))
|
||||
if (!LoadHle(GetPath("/data/")))
|
||||
return -3;
|
||||
else
|
||||
printf("Did not load bios, using reios\n");
|
||||
|
|
Loading…
Reference in New Issue