about summary refs log tree commit diff stats
path: root/src/custommem.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-05-28 09:39:26 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-05-28 09:39:26 +0200
commit0b67bba12111bad3bdc7abc83d82e7016efb97ec (patch)
treeafae06a6dd18028d3f523c8c8a0acc41e2f38992 /src/custommem.c
parenta791677534315fb4c7708db907605ed61cb8b239 (diff)
downloadbox64-0b67bba12111bad3bdc7abc83d82e7016efb97ec.tar.gz
box64-0b67bba12111bad3bdc7abc83d82e7016efb97ec.zip
[DYNAREC] Do not track memory that is not accessible (should save some memory)
Diffstat (limited to 'src/custommem.c')
-rw-r--r--src/custommem.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/custommem.c b/src/custommem.c
index 8d7925ab..6cb7cedb 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -1100,7 +1100,13 @@ void setProtection(uintptr_t addr, size_t size, uint32_t prot)
 
 void setProtection_mmap(uintptr_t addr, size_t size, uint32_t prot)
 {
-    setProtection(addr, size, prot|PROT_MMAP);
+    if(prot)
+        setProtection(addr, size, prot|PROT_MMAP);
+    else {
+        mutex_lock(&mutex_prot);
+        addMapMem(addr, addr+size-1);
+        mutex_unlock(&mutex_prot);
+    }
 }
 
 void refreshProtection(uintptr_t addr)