diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-04-02 18:45:04 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-04-02 18:45:04 +0200 |
| commit | b3a2031484465e26f71c9bee00ce5e2e9d6fc65a (patch) | |
| tree | 4134f14fb911f03a5abbb7850fbcd7a89b6388b6 /src/tools | |
| parent | abf6e4856c62db53eba7b5a06e9a83d234cad8c8 (diff) | |
| download | box64-b3a2031484465e26f71c9bee00ce5e2e9d6fc65a.tar.gz box64-b3a2031484465e26f71c9bee00ce5e2e9d6fc65a.zip | |
[DYNAREC] Never protect bridge memory (ported from box86)
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/bridge.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/tools/bridge.c b/src/tools/bridge.c index 3bc7ca22..16aaaf74 100755 --- a/src/tools/bridge.c +++ b/src/tools/bridge.c @@ -60,6 +60,9 @@ brick_t* NewBrick(void* old) if(ptr == MAP_FAILED) { printf_log(LOG_NONE, "Warning, cannot allocate 0x%lx aligned bytes for bridge, will probably crash later\n", NBRICK*sizeof(onebridge_t)); } + #ifdef DYNAREC + setProtection((uintptr_t)ptr, NBRICK * sizeof(onebridge_t), PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NOPROT); + #endif dynarec_log(LOG_INFO, "New Bridge brick at %p (size 0x%zx)\n", ptr, NBRICK*sizeof(onebridge_t)); ret->b = ptr; return ret; @@ -82,10 +85,6 @@ void FreeBridge(bridge_t** bridge) x64emu_t* emu = thread_get_emu(); while(b) { brick_t *n = b->next; - #ifdef DYNAREC - if(getProtection((uintptr_t)b->b)&(PROT_DYNAREC|PROT_DYNAREC_R)) - unprotectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t), 0); - #endif my_munmap(emu, b->b, NBRICK*sizeof(onebridge_t)); box_free(b); b = n; @@ -119,24 +118,12 @@ 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; mutex_unlock(&my_context->mutex_bridge); - #ifdef DYNAREC - int prot = 0; - if(box64_dynarec) { - prot=(getProtection((uintptr_t)b->b)&(PROT_DYNAREC|PROT_DYNAREC_R))?1:0; - if(prot) - unprotectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t), 0); // don't mark blocks, it's only new one - } - #endif b->b[sz].CC = 0xCC; b->b[sz].S = 'S'; b->b[sz].C='C'; b->b[sz].w = w; b->b[sz].f = (uintptr_t)fnc; b->b[sz].C3 = N?0xC2:0xC3; b->b[sz].N = N; - #ifdef DYNAREC - if(box64_dynarec) - protectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t)); - #endif #ifdef HAVE_TRACE if(name) addBridgeName(fnc, name); |