about summary refs log tree commit diff stats
path: root/src/dynarec
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-07-17 18:03:23 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-07-17 18:03:23 +0200
commit139d5128a0afbd86b0dae43f59f86e9c63e810b6 (patch)
tree434fcdd57587dddcfd3d342f0812692acf6bacb9 /src/dynarec
parent7b8bd8a2855b8c1f23057d0b0ae09b85d0120394 (diff)
downloadbox64-139d5128a0afbd86b0dae43f59f86e9c63e810b6.tar.gz
box64-139d5128a0afbd86b0dae43f59f86e9c63e810b6.zip
Made IRETQ to restore RSP and SS ([DYNAREC] too) (helps Wine64 exceptions handling)
Diffstat (limited to 'src/dynarec')
-rwxr-xr-xsrc/dynarec/dynarec_arm64_helper.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dynarec/dynarec_arm64_helper.c b/src/dynarec/dynarec_arm64_helper.c
index ea8274ae..e598c47b 100755
--- a/src/dynarec/dynarec_arm64_helper.c
+++ b/src/dynarec/dynarec_arm64_helper.c
@@ -462,12 +462,20 @@ void iret_to_epilog(dynarec_arm_t* dyn, int ninst, int is64bits)
     STRH_U12(x2, xEmu, offsetof(x64emu_t, segs[_CS]));
     MOVZw(x1, 0);
     STRx_U12(x1, xEmu, offsetof(x64emu_t, segs_serial[_CS]));
+    STRx_U12(x1, xEmu, offsetof(x64emu_t, segs_serial[_SS]));
     // POP EFLAGS
     POP1(xFlags);
     MOV32w(x1, 0x3F7FD7);
     ANDx_REG(xFlags, xFlags, x1);
     ORRx_mask(xFlags, xFlags, 1, 0b111111, 0);
     SET_DFNONE(x1);
+    // POP RSP
+    POP1(x3);
+    // POP SS
+    POP1(x2);
+    STRH_U12(x2, xEmu, offsetof(x64emu_t, segs[_SS]));
+    // set new RSP
+    MOVx_REG(xRSP, x3);
     // Ret....
     MOV64x(x2, (uintptr_t)arm64_epilog);  // epilog on purpose, CS might have changed!
     BR(x2);