about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-06 10:49:21 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-06 10:49:21 +0100
commit65a64003ba135fc21d4a2d3158568277506c2118 (patch)
tree30a750deb96013848ac9ccef839976b1d31e0363 /src
parent8ca2c829de2494a5c453c19cf618a36e63e6eea3 (diff)
downloadbox64-65a64003ba135fc21d4a2d3158568277506c2118.tar.gz
box64-65a64003ba135fc21d4a2d3158568277506c2118.zip
Fixed GetEb handling
Diffstat (limited to 'src')
-rwxr-xr-xsrc/emu/x64emu.c18
-rwxr-xr-xsrc/emu/x64run.c24
-rwxr-xr-xsrc/emu/x64run_private.h4
3 files changed, 14 insertions, 32 deletions
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c
index d138b265..57d50479 100755
--- a/src/emu/x64emu.c
+++ b/src/emu/x64emu.c
@@ -109,15 +109,15 @@ void SetupX64Emu(x64emu_t *emu)
 
 void SetTraceEmu(uintptr_t start, uintptr_t end)
 {
-//    if(my_context->zydis) {
-//        if (end == 0) {
-//            printf_log(LOG_INFO, "Setting trace\n");
-//        } else {
-//            if(end!=1) {  // 0-1 is basically no trace, so don't printf it...
-//                printf_log(LOG_INFO, "Setting trace only between %p and %p\n", (void*)start, (void*)end);
-//            }
-//        }
-//    }
+    if(my_context->zydis) {
+        if (end == 0) {
+            printf_log(LOG_INFO, "Setting trace\n");
+        } else {
+            if(end!=1) {  // 0-1 is basically no trace, so don't printf it...
+                printf_log(LOG_INFO, "Setting trace only between %p and %p\n", (void*)start, (void*)end);
+            }
+        }
+    }
     trace_start = start;
     trace_end = end;
 }
diff --git a/src/emu/x64run.c b/src/emu/x64run.c
index fc804bc1..953966be 100755
--- a/src/emu/x64run.c
+++ b/src/emu/x64run.c
@@ -69,11 +69,11 @@ x64emurun:
             rep = opcode-0xF1;
             opcode = F8;
         }
-        if(opcode>=0x40 && opcode<=0x4f) {
+        rex.rex = 0;
+        while(opcode>=0x40 && opcode<=0x4f) {
             rex.rex = opcode;
             opcode = F8;
-        } else
-            rex.rex = 0;
+        }
 
         switch(opcode) {
 
@@ -191,24 +191,6 @@ x64emurun:
                 cmp32(emu, R_EAX, F32);
             break;
 
-        case 0x40:
-        case 0x41:
-        case 0x42:
-        case 0x43:
-        case 0x44:
-        case 0x45:
-        case 0x46:
-        case 0x47:
-        case 0x48:
-        case 0x49:
-        case 0x4A:
-        case 0x4B:
-        case 0x4C:
-        case 0x4D:
-        case 0x4E:
-        case 0x4F:      /* Another REX */
-            --R_RIP;
-            break;
         case 0x54:                      /* PUSH ESP */
             if(rex.b)
                 Push(emu, R_R12);
diff --git a/src/emu/x64run_private.h b/src/emu/x64run_private.h
index 3c842d0f..4a79c1b5 100755
--- a/src/emu/x64run_private.h
+++ b/src/emu/x64run_private.h
@@ -106,10 +106,10 @@ static inline reg64_t* GetEb(x64emu_t *emu, rex_t rex, uint8_t v)
     uint8_t m = v&0xC7;    // filter Eb
     if(m>=0xC0) {
         if(rex.rex) {
+            return &emu->regs[(m&0x07)+(rex.b<<3)];
+        } else {
             int lowhigh = (m&4)>>2;
             return (reg64_t *)(((char*)(&emu->regs[(m&0x03)]))+lowhigh);  //?
-        } else {
-            return &emu->regs[(m&0x07)+(rex.b<<3)];
         }
     } else return GetECommon(emu, rex, m);
 }