X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fpsxmem.c;h=8c7c37b6b81c0206160588e3a800a1bbc51c6276;hp=cc27552aa6f52da26314bc2db06076dbaa9b9557;hb=c6c3b1b36e53f576f540cbf99fb9f8d66ae1e92a;hpb=f95a77f74f9608f9c63780fee20fcc5255042ac3 diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index cc27552a..8c7c37b6 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -26,6 +26,7 @@ #include "psxmem.h" #include "r3000a.h" #include "psxhw.h" +#include "debug.h" #include #ifndef MAP_ANONYMOUS @@ -73,10 +74,12 @@ int psxMemInit() { psxP = &psxM[0x200000]; psxH = &psxM[0x210000]; - psxR = (s8 *)malloc(0x00080000); + psxR = mmap((void *)0x9fc00000, 0x80000, + PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (psxMemRLUT == NULL || psxMemWLUT == NULL || - psxM != (void *)0x80000000 || psxP == NULL || psxH == NULL) { + psxM != (void *)0x80000000 || psxR != (void *)0x9fc00000 || + psxP == NULL || psxH == NULL) { SysMessage(_("Error allocating memory!")); return -1; } @@ -132,8 +135,8 @@ void psxMemReset() { void psxMemShutdown() { munmap(psxM, 0x00220000); + munmap(psxR, 0x80000); - free(psxR); free(psxMemRLUT); free(psxMemWLUT); } @@ -259,7 +262,7 @@ void psxMemWrite16(u32 mem, u16 value) { DebugCheckBP((mem & 0xffffff) | 0x80000000, W2); *(u16 *)(p + (mem & 0xffff)) = SWAPu16(value); #ifdef PSXREC - psxCpu->Clear((mem & (~1)), 1); + psxCpu->Clear((mem & (~3)), 1); #endif } else { #ifdef PSXMEM_LOG