diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-28 15:08:55 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-28 15:08:55 +0200 |
| commit | ba1493857f16f8d8e9eec8f3d421e49784761e8d (patch) | |
| tree | 5a26df7bf3ab0bc6dd6505a0dc21890f5deddf25 /src/tools | |
| parent | fb7a0318a0e93b099cf781ea5bb285b97092d277 (diff) | |
| download | box64-ba1493857f16f8d8e9eec8f3d421e49784761e8d.tar.gz box64-ba1493857f16f8d8e9eec8f3d421e49784761e8d.zip | |
[DYNAREC] Improved Dynablock construction, stopping when overlaping block is detected
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/bridge.c | 7 |
1 files changed, 4 insertions, 3 deletions
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 |