enum psxMapTag tag)
{
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
- int tried_to_align = 0;
+ int try_ = 0;
unsigned long mask;
void *req, *ret;
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;
}
}
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"));