about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-14 21:51:25 +0800
committerGitHub <noreply@github.com>2025-01-14 14:51:25 +0100
commit0cd53ca74803347d4c9a58596cfe7ec27ecedba2 (patch)
tree0030b124df3cb86bc64afac6e79ba3b950de7c9e /src
parentfa2bd920bd2b80900de2958bed87af5a70796a54 (diff)
downloadbox64-0cd53ca74803347d4c9a58596cfe7ec27ecedba2.tar.gz
box64-0cd53ca74803347d4c9a58596cfe7ec27ecedba2.zip
[RV64_DYNAREC] Fixed stack out of sync in native call (#2263)
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c
index ebf8cd97..af44f12b 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.c
+++ b/src/dynarec/rv64/dynarec_rv64_helper.c
@@ -844,6 +844,9 @@ void call_n(dynarec_rv64_t* dyn, int ninst, void* fnc, int w)
 {
     MAYUSE(fnc);
     fpu_pushcache(dyn, ninst, x3, 1);
+    // save RSP in case there are x86 callbacks...
+    SD(xRSP, xEmu, offsetof(x64emu_t, regs[_SP]));
+    SD(xRBP, xEmu, offsetof(x64emu_t, regs[_BP]));
     // check if additional sextw needed
     int sextw_mask = ((w > 0 ? w : -w) >> 4) & 0b111111;
     for (int i = 0; i < 6; i++) {