diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-07-23 11:15:31 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-07-23 11:15:31 +0200 |
| commit | b2c2f7bbd24dec0178af1172c46bbac33f38205b (patch) | |
| tree | bd5e5c4c492ae9e291f217f20e80b3126a93d9e5 | |
| parent | da6ad1a43d85e0a9ad4f2801f5b5bdb73dc55055 (diff) | |
| download | box64-b2c2f7bbd24dec0178af1172c46bbac33f38205b.tar.gz box64-b2c2f7bbd24dec0178af1172c46bbac33f38205b.zip | |
[32BITS] Added 66 50-5F opcodes ([ARM64_DYNAREC] too, and fixed 66 61 opcode)
| -rw-r--r-- | src/dynarec/arm64/dynarec_arm64_66.c | 61 | ||||
| -rw-r--r-- | src/emu/x64run66.c | 67 |
2 files changed, 98 insertions, 30 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_66.c b/src/dynarec/arm64/dynarec_arm64_66.c index 8f588207..cb1e1c51 100644 --- a/src/dynarec/arm64/dynarec_arm64_66.c +++ b/src/dynarec/arm64/dynarec_arm64_66.c @@ -319,7 +319,44 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin emit_dec16(dyn, ninst, x1, x2, x3); BFIw(gd, x1, 0, 16); break; - + case 0x50: + case 0x51: + case 0x52: + case 0x53: + case 0x54: + case 0x55: + case 0x56: + case 0x57: + if(rex.is32bits) { + INST_NAME("PUSH reg"); + gd = xRAX+(opcode&0x07); + if (gd == xRSP) { + MOVw_REG(x1, xRSP); + PUSH1_16(x1); + } else { + PUSH1_16(gd); + } + } else { + DEFAULT; + } + break; + case 0x58: + case 0x59: + case 0x5A: + case 0x5B: + case 0x5C: + case 0x5D: + case 0x5E: + case 0x5F: + if(rex.is32bits) { + INST_NAME("POP reg"); + gd = xRAX+(opcode&0x07); + POP1_16(x1); + BFIw(gd, x1, 0, 16); + } else { + DEFAULT; + } + break; case 0x60: if(rex.is32bits) { INST_NAME("PUSHA 16 (32bits)"); @@ -339,15 +376,21 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x61: if(rex.is32bits) { INST_NAME("POPA 16 (32bits)"); - MOVw_REG(x1, xRSP); - LDRH_S9_postindex(xRDI, xRSP, 2); - LDRH_S9_postindex(xRSI, xRSP, 2); - LDRH_S9_postindex(xRBP, xRSP, 2); LDRH_S9_postindex(x1, xRSP, 2); - LDRH_S9_postindex(xRBX, xRSP, 2); - LDRH_S9_postindex(xRDX, xRSP, 2); - LDRH_S9_postindex(xRCX, xRSP, 2); - LDRH_S9_postindex(xRAX, xRSP, 2); + BFIw(xRDI, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRSI, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRBP, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); // RSP ignored + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRBX, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRDX, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRCX, x1, 0, 16); + LDRH_S9_postindex(x1, xRSP, 2); + BFIw(xRAX, x1, 0, 16); } else { DEFAULT; } diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c index 4a6f92aa..938fde48 100644 --- a/src/emu/x64run66.c +++ b/src/emu/x64run66.c @@ -166,7 +166,33 @@ uintptr_t Run66(x64emu_t *emu, rex_t rex, int rep, uintptr_t addr) tmp8u = opcode&7; emu->regs[tmp8u].word[0] = dec16(emu, emu->regs[tmp8u].word[0]); break; - + case 0x50: + case 0x51: + case 0x52: + case 0x53: + case 0x55: + case 0x56: + case 0x57: /* PUSH Reg */ + if(rex.is32bits) { + tmp8u = opcode&7; + Push16(emu, emu->regs[tmp8u].word[0]); + } else + return 0; + break; + case 0x58: + case 0x59: + case 0x5A: + case 0x5B: + case 0x5C: /* POP ESP */ + case 0x5D: + case 0x5E: + case 0x5F: /* POP Reg */ + if(rex.is32bits) { + tmp8u = opcode&7; + emu->regs[tmp8u].word[0] = Pop16(emu); + } else + return 0; + break; case 0x60: /* PUSHA */ if(rex.is32bits) { tmp16u = R_SP; @@ -338,27 +364,26 @@ uintptr_t Run66(x64emu_t *emu, rex_t rex, int rep, uintptr_t addr) GD->word[0] = (uint16_t)tmp64u; break; - case 0x90: /* NOP or XCHG R8d, AX*/ - case 0x91: - case 0x92: - case 0x93: - case 0x94: - case 0x95: - case 0x96: - case 0x97: /* XCHG reg,AX */ - tmp8u = _AX+(opcode&7)+(rex.b<<3); - if(tmp8u!=_AX) { - if(rex.w) { - tmp64u = R_RAX; - R_RAX = emu->regs[tmp8u].q[0]; - emu->regs[tmp8u].q[0] = tmp64u; - } else { - tmp16u = R_AX; - R_AX = emu->regs[tmp8u].word[0]; - emu->regs[tmp8u].word[0] = tmp16u; - } + case 0x90: /* NOP or XCHG R8d, AX*/ + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: /* XCHG reg,AX */ + tmp8u = _AX+(opcode&7)+(rex.b<<3); + if(tmp8u!=_AX) { + if(rex.w) { + tmp64u = R_RAX; + R_RAX = emu->regs[tmp8u].q[0]; + emu->regs[tmp8u].q[0] = tmp64u; + } else { + tmp16u = R_AX; + R_AX = emu->regs[tmp8u].word[0]; + emu->regs[tmp8u].word[0] = tmp16u; } - break; + } break; case 0x98: /* CBW */ |