about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-11-07 13:26:55 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-11-07 13:26:55 +0100
commitda0e153a055dde5c7b6fa0eaa79095b0ffdca518 (patch)
tree2b3c71b4a7b43e4e40086054d82c3d98044c869d /src/emu
parent394e81af452f64439fb8d8ab7254ce19f71d4390 (diff)
downloadbox64-da0e153a055dde5c7b6fa0eaa79095b0ffdca518.tar.gz
box64-da0e153a055dde5c7b6fa0eaa79095b0ffdca518.zip
[BOX32] Improve errno handling, and added a few more libc wrapped functions
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/x64emu.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c
index 5da102af..4ec5b1fd 100644
--- a/src/emu/x64emu.c
+++ b/src/emu/x64emu.c
@@ -554,12 +554,22 @@ void StopEmu(x64emu_t* emu, const char* reason, int is32bits)
     // dump stuff...
     printf_log(LOG_NONE, "==== CPU Registers ====\n%s\n", DumpCPURegs(emu, R_RIP, is32bits));
     printf_log(LOG_NONE, "======== Stack ========\nStack is from %lX to %lX\n", R_RBP, R_RSP);
-    if (R_RBP == R_RSP) {
-        printf_log(LOG_NONE, "RBP = RSP: leaf function detected; next 128 bytes should be either data or random.\n");
+    if(emu->segs[_CS]==0x23) {
+        if (R_EBP == R_ESP) {
+            printf_log(LOG_NONE, "EBP = ESP: leaf function detected; next 128 bytes should be either data or random.\n");
+        } else {
+            // TODO: display stack if operation should be allowed (to avoid crashes)
+            /* for (uint64_t *sp = R_RBP; sp >= R_RSP; --sp) {
+            } */
+        }
     } else {
-        // TODO: display stack if operation should be allowed (to avoid crashes)
-        /* for (uint64_t *sp = R_RBP; sp >= R_RSP; --sp) {
-        } */
+        if (R_RBP == R_RSP) {
+            printf_log(LOG_NONE, "RBP = RSP: leaf function detected; next 128 bytes should be either data or random.\n");
+        } else {
+            // TODO: display stack if operation should be allowed (to avoid crashes)
+            /* for (uint64_t *sp = R_RBP; sp >= R_RSP; --sp) {
+            } */
+        }
     }
     printf_log(LOG_NONE, "Old IP: %tX\n", emu->old_ip);
 #ifdef HAVE_TRACE