diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-02-12 16:38:12 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-02-12 16:38:12 +0100 |
| commit | 96a7d1e7ec0fa1266304779389359804e6108795 (patch) | |
| tree | 889bec6cc539ff6a6ea655b56d293c874480700e /src/tools | |
| parent | 2d2a65b616b1bb4250cfdc1d300f7bbc14685a3a (diff) | |
| download | box64-96a7d1e7ec0fa1266304779389359804e6108795.tar.gz box64-96a7d1e7ec0fa1266304779389359804e6108795.zip | |
[DYNAREC] Use custom mutex, improved Signal while FillBlocks64 and atomic handling
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/bridge.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/bridge.c b/src/tools/bridge.c index 61960898..514ce989 100755 --- a/src/tools/bridge.c +++ b/src/tools/bridge.c @@ -105,7 +105,7 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* int sz = -1; int ret; - pthread_mutex_lock(&my_context->mutex_bridge); + mutex_lock(&my_context->mutex_bridge); b = bridge->last; if(b->sz == NBRICK) { b->next = NewBrick(b->b); @@ -117,7 +117,7 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* // add bridge to map, for fast recovery khint_t k = kh_put(bridgemap, bridge->bridgemap, (uintptr_t)fnc, &ret); kh_value(bridge->bridgemap, k) = (uintptr_t)&b->b[sz].CC; - pthread_mutex_unlock(&my_context->mutex_bridge); + mutex_unlock(&my_context->mutex_bridge); #ifdef DYNAREC int prot = 0; @@ -234,7 +234,7 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num) int prot = 0; do { #endif - pthread_mutex_lock(&my_context->mutex_bridge); + mutex_lock(&my_context->mutex_bridge); b = bridge->last; if(b->sz == NBRICK) { b->next = NewBrick(b->b); @@ -243,7 +243,7 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num) } sz = b->sz; #ifdef DYNAREC - pthread_mutex_unlock(&my_context->mutex_bridge); + mutex_unlock(&my_context->mutex_bridge); if(box64_dynarec) { prot=(getProtection((uintptr_t)b->b)&(PROT_DYNAREC|PROT_DYNAREC_R))?1:0; if(prot) @@ -252,7 +252,7 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num) 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(&my_context->mutex_bridge); + mutex_lock(&my_context->mutex_bridge); #endif b->sz++; b->b[sz].B8 = 0xB8; @@ -260,7 +260,7 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num) b->b[sz]._0F = 0x0F; b->b[sz]._05 = 0x05; b->b[sz]._C3 = 0xC3; - pthread_mutex_unlock(&my_context->mutex_bridge); + mutex_unlock(&my_context->mutex_bridge); #ifdef DYNAREC if(box64_dynarec) protectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t)); |