From ba1493857f16f8d8e9eec8f3d421e49784761e8d Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 28 Mar 2021 15:08:55 +0200 Subject: [DYNAREC] Improved Dynablock construction, stopping when overlaping block is detected --- src/tools/bridge.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/tools') diff --git a/src/tools/bridge.c b/src/tools/bridge.c index a5aecc89..3a3e6768 100755 --- a/src/tools/bridge.c +++ b/src/tools/bridge.c @@ -91,14 +91,15 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* b = b->next; bridge->last = b; } - sz = b->sz; + sz = b->sz; #ifdef DYNAREC pthread_mutex_unlock(&bridge->mutex); if(box64_dynarec) { prot=(getProtection((uintptr_t)b->b)&PROT_DYNAREC)?1:0; if(prot) unprotectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t)); - addDBFromAddressRange((uintptr_t)&b->b[b->sz].CC, sizeof(onebridge_t)); + else // only add DB if there is no protection + addDBFromAddressRange((uintptr_t)&b->b[b->sz].CC, sizeof(onebridge_t)); } } while(sz!=b->sz); // this while loop if someone took the slot when the bridge mutex was unlocked doing memory protection managment pthread_mutex_lock(&bridge->mutex); @@ -116,7 +117,7 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* kh_value(bridge->bridgemap, k) = (uintptr_t)&b->b[sz].CC; pthread_mutex_unlock(&bridge->mutex); #ifdef DYNAREC - if(box64_dynarec && prot) + if(box64_dynarec) protectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t)); #endif #ifdef HAVE_TRACE -- cgit 1.4.1