about summary refs log tree commit diff stats
path: root/src/libtools
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-05-04 10:07:20 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-05-04 10:07:20 +0200
commit66b4dcf37a50bb678db469c777e798a4b908fdde (patch)
tree39464092c449bd4b1201828b672774922a1c9715 /src/libtools
parent1462d5c6bd62cc62f9c16e3c879cbe729b37d356 (diff)
downloadbox64-66b4dcf37a50bb678db469c777e798a4b908fdde.tar.gz
box64-66b4dcf37a50bb678db469c777e798a4b908fdde.zip
[DYNAREC] Improve handling of running block getting dirty while executing
Diffstat (limited to 'src/libtools')
-rwxr-xr-xsrc/libtools/signals.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c
index 39dc190e..6ed5f807 100755
--- a/src/libtools/signals.c
+++ b/src/libtools/signals.c
@@ -939,7 +939,8 @@ void my_box64signalhandler(int32_t sig, siginfo_t* info, void * ucntx)
         }
         // access error, unprotect the block (and mark them dirty)
         unprotectDB((uintptr_t)addr, 1, 1);    // unprotect 1 byte... But then, the whole page will be unprotected
-        if(db && ((addr>=db->x64_addr && addr<(db->x64_addr+db->x64_size)) || getNeedTest((uintptr_t)db->x64_addr))) {
+        int db_need_test = db?getNeedTest((uintptr_t)db->x64_addr):0;
+        if(db && ((addr>=db->x64_addr && addr<(db->x64_addr+db->x64_size)) || db_need_test)) {
             // dynablock got auto-dirty! need to get out of it!!!
             emu_jmpbuf_t* ejb = GetJmpBuf();
             if(ejb->jmpbuf_ok) {
@@ -984,7 +985,7 @@ void my_box64signalhandler(int32_t sig, siginfo_t* info, void * ucntx)
             dynarec_log(LOG_INFO, "Warning, Auto-SMC (%p for db %p/%p) detected, but jmpbuffer not ready!\n", (void*)addr, db, (void*)db->x64_addr);
         }
         // done
-        if((prot&PROT_WRITE) || (prot&PROT_DYNAREC)) {
+        if((prot&PROT_WRITE)/*|| (prot&PROT_DYNAREC)*/) {
             mutex_unlock(&mutex_dynarec_prot);
             // if there is no write permission, don't return and continue to program signal handling
             relockMutex(Locks);