about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-10-13 15:40:58 +0800
committerGitHub <noreply@github.com>2025-10-13 09:40:58 +0200
commitbbd22d76bed388be541dd160db15161300ea6306 (patch)
tree9f85e8605c32e9524b030f90c47d3d75ee4c0ab1
parent256632ea4c21bbadc2131cfb65aaebfde4af3215 (diff)
downloadbox64-bbd22d76bed388be541dd160db15161300ea6306.tar.gz
box64-bbd22d76bed388be541dd160db15161300ea6306.zip
[INTERP] Fixed 16bit PUSH/POP opcodes (#3064)
-rw-r--r--src/emu/x64run66.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c
index 49e9ce18..10d62acb 100644
--- a/src/emu/x64run66.c
+++ b/src/emu/x64run66.c
@@ -205,7 +205,8 @@ uintptr_t Run66(x64emu_t *emu, rex_t rex, uintptr_t addr)
     case 0x55:

     case 0x56:

     case 0x57:                      /* PUSH Reg */

-        tmp16u = emu->regs[opcode&7].word[0];

+        tmp8u = (opcode&7)+(rex.b<<3);

+        tmp16u = emu->regs[tmp8u].word[0];

         Push16(emu, tmp16u);

         break;

     case 0x58:

@@ -216,7 +217,7 @@ uintptr_t Run66(x64emu_t *emu, rex_t rex, uintptr_t addr)
     case 0x5D:

     case 0x5E:

     case 0x5F:                      /* POP Reg */

-        tmp8u = opcode&7;

+        tmp8u = (opcode&7)+(rex.b<<3);

         emu->regs[tmp8u].word[0] = Pop16(emu);

         break;

     case 0x60:                              /* PUSHA */