about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-11-21 15:28:30 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-11-21 15:28:30 +0100
commita39249454e5361813504d9a1da3430a2f1255a68 (patch)
treeec1ce7f2eb9f8699f2d6d6d9a88ce414cd0d734d /src
parentc1f2304c887afc2e25becbf33ad3646cb8554a4c (diff)
downloadbox64-a39249454e5361813504d9a1da3430a2f1255a68.tar.gz
box64-a39249454e5361813504d9a1da3430a2f1255a68.zip
Slightly better way to decode wrappers
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64int3.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c
index 349974fa..9b468279 100644
--- a/src/emu/x64int3.c
+++ b/src/emu/x64int3.c
@@ -93,7 +93,7 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
         return;
     }
     onebridge_t* bridge = (onebridge_t*)(*addr-1);
-    if(Peek8(*addr, 0)=='S' && Peek8(*addr, 1)=='C') // Signature for "Out of x86 door"
+    if(bridge->S=='S' && bridge->C=='C') // Signature for "Out of x86 door"
     {
         *addr += 2;
         uintptr_t a = F64(addr);
@@ -384,6 +384,11 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
         }
         return;
     }
+    if(Peek8(*addr, -1)!=0xCC) {
+        // why this happens?!
+        printf_log(LOG_DEBUG, "%04d|Warning, x64int3 with no CC opcode at %p?\n", GetTID(), (void*)R_RIP);
+        return;
+    }
     if(!box64_ignoreint3 && my_context->signals[SIGTRAP]) {
         R_RIP = *addr;  // update RIP
         emit_signal(emu, SIGTRAP, NULL, 3);