From 5ee43854771d711cc75fa75693efcd11e933498c Mon Sep 17 00:00:00 2001 From: Chi-Kuan Chiu <105687635+devarajabc@users.noreply.github.com> Date: Sat, 3 May 2025 17:40:29 +0800 Subject: Use `setProtection_mmap` in `NewBrick` (#2599) NewBrick() currently uses setProtection() after box_mmap(), which fails to mark the region with the `MEM_MMAP` label. As a result, getMmapped() returns 0, even though the memory was allocated via mmap. Closes #2598 --- src/tools/bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/bridge.c b/src/tools/bridge.c index 1ad0c3e5..e9669fa2 100644 --- a/src/tools/bridge.c +++ b/src/tools/bridge.c @@ -55,7 +55,7 @@ brick_t* NewBrick(void* old) if(ptr == MAP_FAILED) { printf_log(LOG_NONE, "Warning, cannot allocate 0x%lx aligned bytes for bridge, will probably crash later\n", NBRICK*sizeof(onebridge_t)); } - setProtection((uintptr_t)ptr, NBRICK * sizeof(onebridge_t), PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NOPROT); + setProtection_mmap((uintptr_t)ptr, NBRICK * sizeof(onebridge_t), PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NOPROT); dynarec_log(LOG_INFO, "New Bridge brick at %p (size 0x%zx)\n", ptr, NBRICK*sizeof(onebridge_t)); if(box64_is32bits) load_addr_32bits = ptr + NBRICK*sizeof(onebridge_t); ret->b = ptr; -- cgit 1.4.1