about summary refs log tree commit diff stats
path: root/src/dynarec
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-04-07 17:09:47 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-04-07 17:09:47 +0200
commit4693cac13b3e6cbffa0571a3fb7bb9ec6cfe0241 (patch)
treebd2895c46820869c0fadba7cefdbbe2d0a9f5049 /src/dynarec
parent7e09961ee7ac6841883b68123ad700609d2fd955 (diff)
downloadbox64-4693cac13b3e6cbffa0571a3fb7bb9ec6cfe0241.tar.gz
box64-4693cac13b3e6cbffa0571a3fb7bb9ec6cfe0241.zip
[DYNAREC] Needed to same a bit more register before native funciton call (fix setjmp no saving all registers)
Diffstat (limited to 'src/dynarec')
-rwxr-xr-xsrc/dynarec/dynarec_arm64_helper.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dynarec/dynarec_arm64_helper.h b/src/dynarec/dynarec_arm64_helper.h
index 73a7948c..4050f47b 100755
--- a/src/dynarec/dynarec_arm64_helper.h
+++ b/src/dynarec/dynarec_arm64_helper.h
@@ -399,6 +399,7 @@
 
 
 #define STORE_REG(A)    STRx_U12(x##A, xEmu, offsetof(x64emu_t, regs[_##A]))
+#define STP_REGS(A, B)  STPx_S7_offset(x##A, x##B, xEmu, offsetof(x64emu_t, regs[_##A]))
 #define STORE_XEMU_REGS(A)  \
     STORE_REG(RAX);         \
     STORE_REG(RCX);         \
@@ -454,7 +455,13 @@
     STRx_U12(xFlags, xEmu, offsetof(x64emu_t, eflags)); \
     if(A) {STRx_U12(A, xEmu, offsetof(x64emu_t, ip));}
 
+// Need to also store current value of some register, as they may be used by functions like setjump
+// so RBX, RSP, RBP, R12..R15 (other are scratch or parameters), R10-R11 not usefull, but why not
+// RBX, RSP and RBP are already saved in call function
 #define STORE_XEMU_CALL(A)  \
+    STP_REGS(R10, R11);     \
+    STP_REGS(R12, R13);     \
+    STP_REGS(R14, R15);     \
     if(A) {STPx_S7_offset(xFlags, A, xEmu, offsetof(x64emu_t, eflags));}    \
     else {STRx_U12(xFlags, xEmu, offsetof(x64emu_t, eflags));}