X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Flightrec%2Fmem.c;h=91bd9084cff2f9704f60740f30c60386ea9b58e6;hb=ccd1ad9280c13ec613b4e377a1c347f594d68761;hp=c3a1421ee7a585d7c192d887a66343608e00d6a4;hpb=e5794429475e9c479904cd20da5283b5de30d4c2;p=pcsx_rearmed.git diff --git a/libpcsxcore/lightrec/mem.c b/libpcsxcore/lightrec/mem.c index c3a1421e..91bd9084 100644 --- a/libpcsxcore/lightrec/mem.c +++ b/libpcsxcore/lightrec/mem.c @@ -3,7 +3,9 @@ * Copyright (C) 2022 Paul Cercueil */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include @@ -171,10 +173,24 @@ int lightrec_init_mmap(void) psxH = (s8 *)map; + map = mmap_huge((void *)(base + 0x800000), CODE_BUFFER_SIZE, + PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED_NOREPLACE | MAP_ANONYMOUS, + 0, 0); + if (map == MAP_FAILED) { + err = -EINVAL; + fprintf(stderr, "Unable to mmap code buffer\n"); + goto err_unmap_scratch; + } + + code_buffer = map; + return 0; +err_unmap_scratch: + munmap(psxH, 0x10000); err_unmap_bios: - munmap(psxR, 0x80000); + munmap(psxR, 0x200000); err_unmap_parallel: munmap(psxP, 0x10000); err_unmap: @@ -187,8 +203,9 @@ void lightrec_free_mmap(void) { unsigned int i; + munmap(code_buffer, CODE_BUFFER_SIZE); munmap(psxH, 0x10000); - munmap(psxR, 0x80000); + munmap(psxR, 0x200000); munmap(psxP, 0x10000); for (i = 0; i < 4; i++) munmap((void *)((uintptr_t)psxM + i * 0x200000), 0x200000);