X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fpsxmem.c;h=1cabd53cfd236b7e5ea012b4915f660d8b9ed642;hp=f0a884191b3529ff6b72780e7db3c7ca7ee06b13;hb=aafcb4ddc257478d613611adcae7cb13fd716577;hpb=ffb0b9e0f051789f97f5efdcfab0b261e62688f9 diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index f0a88419..1cabd53c 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -69,17 +69,26 @@ int psxMemInit() { memset(psxMemWLUT, 0, 0x10000 * sizeof(void *)); psxM = mmap((void *)0x80000000, 0x00210000, - PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); +#ifndef RAM_FIXED + if (psxM == MAP_FAILED) + psxM = mmap((void *)0x70000000, 0x00210000, + PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); +#endif + if (psxM == MAP_FAILED) { + SysMessage(_("mapping main RAM failed")); + return -1; + } psxP = &psxM[0x200000]; psxH = mmap((void *)0x1f800000, 0x00010000, - PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); - psxR = mmap((void *)0x9fc00000, 0x80000, + psxR = mmap((void *)0x1fc00000, 0x80000, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (psxMemRLUT == NULL || psxMemWLUT == NULL || - psxM != (void *)0x80000000 || psxR != (void *)0x9fc00000 || + psxR == MAP_FAILED || psxP == NULL || psxH != (void *)0x1f800000) { SysMessage(_("Error allocating memory!")); return -1; @@ -135,7 +144,8 @@ void psxMemReset() { } void psxMemShutdown() { - munmap(psxM, 0x00220000); + munmap(psxM, 0x00210000); + munmap(psxH, 0x1f800000); munmap(psxR, 0x80000); free(psxMemRLUT);