about summary refs log tree commit diff stats
path: root/src/custommem.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-03 18:01:13 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-03 18:01:13 +0100
commit121d986b1114990ae69a6834cea6979200e0c39b (patch)
tree6c17cb5f45209c098e3e8f6569550d7a3d191c20 /src/custommem.c
parentf18f5c9b85feecb3b5d1744b2cfaf5a2fe6068b5 (diff)
downloadbox64-121d986b1114990ae69a6834cea6979200e0c39b.tar.gz
box64-121d986b1114990ae69a6834cea6979200e0c39b.zip
[DYNAREC] Reworked a bit the Strange SEGSIGV handling
Diffstat (limited to 'src/custommem.c')
-rw-r--r--src/custommem.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/custommem.c b/src/custommem.c
index 478e5950..faac9740 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -729,6 +729,25 @@ void cleanDBFromAddressRange(uintptr_t addr, size_t size, int destroy)
     }
 }
 
+// Will return 1 if at least 1 db in the address range
+int isDBFromAddressRange(uintptr_t addr, size_t size)
+{
+    uintptr_t start_addr = my_context?((addr<my_context->max_db_size)?0:(addr-my_context->max_db_size)):addr;
+    dynarec_log(LOG_DEBUG, "isDBFromAddressRange %p/%p -> %p => ", (void*)addr, (void*)start_addr, (void*)(addr+size-1));
+    dynablock_t* db = NULL;
+    uintptr_t end = addr+size;
+    while (start_addr<end) {
+        start_addr = getDBSize(start_addr, end-start_addr, &db);
+        if(db) {
+            dynarec_log(LOG_DEBUG, "1\n");
+            return 1;
+        }
+    }
+    dynarec_log(LOG_DEBUG, "0\n");
+    return 0;
+}
+
+
 #ifdef JMPTABL_SHIFT4
 static uintptr_t *create_jmptbl(uintptr_t idx0, uintptr_t idx1, uintptr_t idx2, uintptr_t idx3, uintptr_t idx4)
 {