aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpcsxcore/psxmem.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index 6277220..14fd911 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -43,7 +43,7 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag)
{
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
- int tried_to_align = 0;
+ int try_ = 0;
unsigned long mask;
void *req, *ret;
@@ -73,15 +73,15 @@ retry:
return NULL;
}
- if (((addr ^ (long)ret) & 0x00ffffff) && !tried_to_align)
+ if (((addr ^ (unsigned long)ret) & ~0xff000000l) && try_ < 2)
{
psxUnmap(ret, size, tag);
// try to use similarly aligned memory instead
// (recompiler needs this)
- mask = (addr - 1) & ~addr & 0x07ffffff;
- addr = (unsigned long)(ret + mask) & ~mask;
- tried_to_align = 1;
+ mask = try_ ? 0xffff : 0xffffff;
+ addr = ((unsigned long)ret + mask) & ~mask;
+ try_++;
goto retry;
}
}
@@ -137,13 +137,8 @@ int psxMemInit() {
psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
#ifndef RAM_FIXED
-#ifdef __BLACKBERRY_QNX__
if (psxM == NULL)
psxM = psxMap(0x77000000, 0x00210000, 0, MAP_TAG_RAM);
-#else
- if (psxM == NULL)
- psxM = psxMap(0x78000000, 0x00210000, 0, MAP_TAG_RAM);
-#endif
#endif
if (psxM == NULL) {
SysMessage(_("mapping main RAM failed"));