about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2024-01-05 23:55:25 +0800
committerGitHub <noreply@github.com>2024-01-05 16:55:25 +0100
commitade0aa770aabe99f5f54b228208059818ae08a89 (patch)
treee9aa48d6d60d1db62cbdf2bf74d31f0c01368ccc /src/emu
parenta5f2f3b3f1ecdd8651d1c4687a5ab6c0c3cf6546 (diff)
downloadbox64-ade0aa770aabe99f5f54b228208059818ae08a89.tar.gz
box64-ade0aa770aabe99f5f54b228208059818ae08a89.zip
[DYNAREC_RV64] Added CALL/RET optimization (#1183)
* [DYNAREC_RV64] Added CALL/RET optimization

* More hacks on the call/ret optimization

* Small fixes, but still not working

* More fixes

* More fixes
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/x64emu_private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h
index aa6584a7..0c994e59 100644
--- a/src/emu/x64emu_private.h
+++ b/src/emu/x64emu_private.h
@@ -67,6 +67,9 @@ typedef struct x64emu_s {
 	x87control_t cw;
     uint16_t    dummy_cw;   // align...
     mmxcontrol_t mxcsr;
+    #ifdef RV64         // it would be better to use a dedicated register for this like arm64 xSavedSP, but we're running of of free registers.
+    uintptr_t xSPSave;  // sp base value of current dynarec frame, used by call/ret optimization to reset stack when unmatch.
+    #endif
     fpu_ld_t    fpu_ld[8]; // for long double emulation / 80bits fld fst
     fpu_ll_t    fpu_ll[8]; // for 64bits fild / fist sequence
 	fpu_p_reg_t p_regs[8];
@@ -114,6 +117,9 @@ typedef struct x64emu_s {
     void*       init_stack; // initial stack (owned or not)
     uint32_t    size_stack; // stack size (owned or not)
     JUMPBUFF*   jmpbuf;
+    #ifdef RV64
+    uintptr_t   old_savedsp;
+    #endif
 
     x64_ucontext_t *uc_link; // to handle setcontext