about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-22 11:36:28 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-22 11:36:28 +0200
commitd546877e7dddba58f21b67f2595d5be3a2d3cbb7 (patch)
treed01435cb78edb8fa42b0e4621de8e1a4bdec4655 /src
parent9657bd51d08a0c422857dacc1611ee01c2084560 (diff)
downloadbox64-d546877e7dddba58f21b67f2595d5be3a2d3cbb7.tar.gz
box64-d546877e7dddba58f21b67f2595d5be3a2d3cbb7.zip
[DYNAREC] Fixed vsyscall bridge
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/bridge.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/tools/bridge.c b/src/tools/bridge.c
index 54c380b1..73bb8197 100755
--- a/src/tools/bridge.c
+++ b/src/tools/bridge.c
@@ -218,41 +218,22 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num)
 {
     brick_t *b = NULL;
     int sz = -1;
-    #ifdef DYNAREC
-    int prot = 0;
-    do {
-        #endif
-        mutex_lock(&my_context->mutex_bridge);
-        b = bridge->last;
-        if(b->sz == NBRICK) {
-            b->next = NewBrick(b->b);
-            b = b->next;
-            bridge->last = b;
-        }
-	    sz = b->sz;
-        #ifdef DYNAREC
-        mutex_unlock(&my_context->mutex_bridge);
-        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), 1);
-            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
     mutex_lock(&my_context->mutex_bridge);
-    #endif
+    b = bridge->last;
+    if(b->sz == NBRICK) {
+        b->next = NewBrick(b->b);
+        b = b->next;
+        bridge->last = b;
+    }
+    sz = b->sz;
     b->sz++;
+    mutex_unlock(&my_context->mutex_bridge);
+
     b->b[sz].B8 = 0xB8;
     b->b[sz].num = num;
     b->b[sz]._0F = 0x0F;
     b->b[sz]._05 = 0x05;
     b->b[sz]._C3 = 0xC3;
-    mutex_unlock(&my_context->mutex_bridge);
-    #ifdef DYNAREC
-    if(box64_dynarec)
-        protectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t));
-    #endif
 
     return (uintptr_t)&b->b[sz].CC;
 }