Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] Fix fastmem and enable.
  • Loading branch information
Sonicadvance1 committed Sep 2, 2013
1 parent 679957d commit e7157e7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
14 changes: 7 additions & 7 deletions Source/Core/Common/Src/MemArena.cpp
Expand Up @@ -143,20 +143,20 @@ u8* MemArena::Find4GBBase()
return base;
#else
#ifdef ANDROID
const u32 MemSize = 0x04000000;
// Android 4.3 changed how mmap works.
// if we map it private and then munmap it, we can't use the base returned.
// This may be due to changes in them support a full SELinux implementation.
const int flags = MAP_ANON;
#else
const u32 MemSize = 0x31000000;
const int flags = MAP_ANON | MAP_PRIVATE;
#endif
void* base = mmap(0, MemSize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
const u32 MemSize = 0x31000000;
void* base = mmap(0, MemSize, PROT_NONE, flags, -1, 0);
if (base == MAP_FAILED) {
PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno));
return 0;
}
#ifndef ANDROID
// Android 4.3 changes how munmap works which causes crashes.
// Keep the memory space after allocating it...
munmap(base, MemSize);
#endif
return static_cast<u8*>(base);
#endif
#endif
Expand Down
54 changes: 29 additions & 25 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp
Expand Up @@ -32,7 +32,7 @@
#include "JitAsm.h"

#ifdef ANDROID
#define FASTMEM 0
#define FASTMEM 1
#else
#define FASTMEM 1
#endif
Expand Down Expand Up @@ -455,36 +455,40 @@ void JitArm::lhz(UGeckoInstruction inst)
// Backpatch route
// Gets loaded in to RD
// Address is in R10
gpr.Unlock(rA, rB);
if (inst.RA)
if (Core::g_CoreStartupParameter.bFastmem)
{
ARMReg RA = gpr.R(inst.RA);
MOV(R10, RA); // - 4
if (inst.RA)
{
ARMReg RA = gpr.R(inst.RA);
MOV(R10, RA); // - 4
}
else
MOV(R10, 0); // - 4

LoadToReg(RD, R10, 16, (u32)inst.SIMM_16);
}
else
MOV(R10, 0); // - 4

LoadToReg(RD, R10, 16, (u32)inst.SIMM_16);
#else

if (inst.RA)
#endif
{
MOVI2R(rB, inst.SIMM_16);
ARMReg RA = gpr.R(inst.RA);
ADD(rB, rB, RA);
if (inst.RA)
{
MOVI2R(rB, inst.SIMM_16);
ARMReg RA = gpr.R(inst.RA);
ADD(rB, rB, RA);
}
else
MOVI2R(rB, (u32)inst.SIMM_16);

MOVI2R(rA, (u32)&Memory::Read_U16);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);
MOV(rA, R0);
POP(4, R0, R1, R2, R3);
MOV(RD, rA);
}
else
MOVI2R(rB, (u32)inst.SIMM_16);

MOVI2R(rA, (u32)&Memory::Read_U16);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);
MOV(rA, R0);
POP(4, R0, R1, R2, R3);
MOV(RD, rA);

gpr.Unlock(rA, rB);
#endif
SetJumpTarget(DoNotLoad);
}
void JitArm::lha(UGeckoInstruction inst)
Expand Down

0 comments on commit e7157e7

Please sign in to comment.