about summary refs log tree commit diff stats
path: root/src/custommem.c
diff options
context:
space:
mode:
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)