about summary refs log tree commit diff stats
path: root/src/libtools
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-11-14 21:06:33 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-11-14 21:06:33 +0100
commitee509f6350a25e42aca3c705bd35ec8ac4e962dd (patch)
treebd637d638c5465cdcc01b88a37f033312acf4d40 /src/libtools
parent6a7c6cba1235729767b16405780c2362ac835278 (diff)
downloadbox64-ee509f6350a25e42aca3c705bd35ec8ac4e962dd.tar.gz
box64-ee509f6350a25e42aca3c705bd35ec8ac4e962dd.zip
Small fixes and improvement to memory protection handling
Diffstat (limited to 'src/libtools')
-rwxr-xr-xsrc/libtools/signals.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c
index a0ca6c76..a2fdd188 100755
--- a/src/libtools/signals.c
+++ b/src/libtools/signals.c
@@ -934,8 +934,15 @@ dynarec_log(/*LOG_DEBUG*/LOG_INFO, "Repeated SIGSEGV with Access error on %p for
 exit(-1);
     } else {
         if(sig==SIGSEGV && info->si_code==2 && ((prot&~PROT_CUSTOM)==5 || (prot&~PROT_CUSTOM)==7)) {
-            relockMutex(Locks);
-            return; // that's probably just a multi-task glitch, like seen in terraria
+            static uintptr_t old_addr = 0;
+        printf_log(/*LOG_DEBUG*/LOG_INFO, "Strange SIGSEGV with Access error on %p for %p, db=%p, prot=0x%x (old_addr=%p)\n", pc, addr, db, prot, (void*)old_addr);
+            if(old_addr!=(uintptr_t)addr) {
+                old_addr = (uintptr_t)addr;
+                refreshProtection(old_addr);
+                relockMutex(Locks);
+                return; // that's probably just a multi-task glitch, like seen in terraria
+            }
+            old_addr = 0;
         }
         old_code = info->si_code;
         old_pc = pc;