about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-02-14 02:08:53 +0800
committerGitHub <noreply@github.com>2025-02-13 19:08:53 +0100
commitd550f9384ced83b2ac9fc30c9d2b488d9844f7b8 (patch)
tree5228e8ef40e4891ccea71944fd86563849b82a4e /src
parentd59d531f1488f408d272e2e01a8d44c689ae5001 (diff)
downloadbox64-d550f9384ced83b2ac9fc30c9d2b488d9844f7b8.tar.gz
box64-d550f9384ced83b2ac9fc30c9d2b488d9844f7b8.zip
[COSIM] Print decoded instruction mnemonics if trace enabled (#2357)
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64test.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/emu/x64test.c b/src/emu/x64test.c
index b7bed1f1..508d83f1 100644
--- a/src/emu/x64test.c
+++ b/src/emu/x64test.c
@@ -24,14 +24,21 @@
 
 void print_banner(x64emu_t* ref)
 {
-    printf_log(LOG_NONE, "Warning, difference between %s Interpreter and Dynarec in %p (%02x %02x %02x %02x %02x %02x %02x %02x)\n"\
-        "=======================================\n",
-        (ref->segs[_CS]==0x23)?"x86":"x64" ,(void*)ref->old_ip,
-        ((uint8_t*)ref->old_ip)[0], ((uint8_t*)ref->old_ip)[1], ((uint8_t*)ref->old_ip)[2], ((uint8_t*)ref->old_ip)[3],
-        ((uint8_t*)ref->old_ip)[4], ((uint8_t*)ref->old_ip)[5], ((uint8_t*)ref->old_ip)[6], ((uint8_t*)ref->old_ip)[7]
-    );
-    //printf_log(LOG_NONE, "%s\n", DumpCPURegs(ref, ref->old_ip, ref->segs[_CS]==0x23));
-    printf_log(LOG_NONE, "DIFF: Dynarec |  Interpreter\n----------------------\n");
+    zydis_dec_t* dec = (ref->segs[_CS] == 0x23) ? my_context->dec32 : my_context->dec;
+
+    printf_log(LOG_NONE, "Warning, difference between %s Interpreter and Dynarec in %p",
+        (ref->segs[_CS] == 0x23) ? "x86" : "x64", (void*)ref->old_ip);
+    if (dec) {
+        printf_log_prefix(0, LOG_NONE, " (%s)\n", DecodeX64Trace(dec, ref->old_ip, 1));
+    } else {
+        printf_log_prefix(0, LOG_NONE, "(%02x %02x %02x %02x %02x %02x %02x %02x)\n",
+            ((uint8_t*)ref->old_ip)[0], ((uint8_t*)ref->old_ip)[1], ((uint8_t*)ref->old_ip)[2], ((uint8_t*)ref->old_ip)[3],
+            ((uint8_t*)ref->old_ip)[4], ((uint8_t*)ref->old_ip)[5], ((uint8_t*)ref->old_ip)[6], ((uint8_t*)ref->old_ip)[7]);
+    }
+    printf_log(LOG_NONE, "------------------------------------------------\n");
+    printf_log(LOG_NONE, "DIFF: Dynarec |  Interpreter\n");
+    printf_log(LOG_NONE, "------------------------------------------------\n");
+    // printf_log(LOG_NONE, "%s\n", DumpCPURegs(ref, ref->old_ip, ref->segs[_CS]==0x23));
 }
 #define BANNER if(!banner) {banner=1; print_banner(ref);}
 void x64test_check(x64emu_t* ref, uintptr_t ip)