diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-06-26 20:32:57 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 14:32:57 +0200 |
| commit | e75234c83dfcec3458f7f12e600578639bec7cfa (patch) | |
| tree | 16980599919bf5676f551eeec098465b20b8b001 /src | |
| parent | 42b98f77cec444deedf0c7b0c922a36800347e1d (diff) | |
| download | box64-e75234c83dfcec3458f7f12e600578639bec7cfa.tar.gz box64-e75234c83dfcec3458f7f12e600578639bec7cfa.zip | |
[DYNACACHE][LA64] More work on internal reloc (#2779)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_00.c | 2 | ||||
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_helper.c | 14 | ||||
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_helper.h | 7 | ||||
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_pass2.h | 6 | ||||
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_pass3.h | 7 |
5 files changed, 23 insertions, 13 deletions
diff --git a/src/dynarec/la64/dynarec_la64_00.c b/src/dynarec/la64/dynarec_la64_00.c index 30212e92..1fd49564 100644 --- a/src/dynarec/la64/dynarec_la64_00.c +++ b/src/dynarec/la64/dynarec_la64_00.c @@ -1996,7 +1996,7 @@ uintptr_t dynarec64_00(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni INST_NAME("INT 3"); if (!BOX64ENV(ignoreint3)) { // check if TRAP signal is handled - TABLE64(x1, (uintptr_t)my_context); + TABLE64C(x1, const_context); MOV32w(x2, offsetof(box64context_t, signals[SIGTRAP])); LDX_D(x3, x1, x2); BEQZ_MARK(x3); diff --git a/src/dynarec/la64/dynarec_la64_helper.c b/src/dynarec/la64/dynarec_la64_helper.c index 265bd117..ddc51082 100644 --- a/src/dynarec/la64/dynarec_la64_helper.c +++ b/src/dynarec/la64/dynarec_la64_helper.c @@ -502,7 +502,7 @@ void jump_to_epilog(dynarec_la64_t* dyn, uintptr_t ip, int reg, int ninst) } else { GETIP_(ip); } - TABLE64(x2, (uintptr_t)la64_epilog); + TABLE64C(x2, const_epilog); SMEND(); BR(x2); } @@ -521,7 +521,7 @@ void jump_to_epilog_fast(dynarec_la64_t* dyn, uintptr_t ip, int reg, int ninst) } else { GETIP_(ip); } - TABLE64(x2, (uintptr_t)la64_epilog_fast); + TABLE64C(x2, const_epilog_fast); SMEND(); BR(x2); } @@ -533,14 +533,12 @@ static int indirect_lookup(dynarec_la64_t* dyn, int ninst, int is32bits, int s1, if (!is32bits) { SRLI_D(s1, xRIP, 48); BNEZ_safe(s1, (intptr_t)dyn->jmp_next - (intptr_t)dyn->block); - uintptr_t tbl = getJumpTable48(); - MOV64x(s2, tbl); + MOV64x(s2, getConst(const_jmptbl48)); BSTRPICK_D(s1, xRIP, JMPTABL_START2 + JMPTABL_SHIFT2 - 1, JMPTABL_START2); ALSL_D(s2, s1, s2, 3); LD_D(s2, s2, 0); } else { - uintptr_t tbl = getJumpTable32(); - TABLE64(s2, tbl); + TABLE64C(s2, const_jmptbl32); } BSTRPICK_D(s1, xRIP, JMPTABL_START1 + JMPTABL_SHIFT1 - 1, JMPTABL_START1); ALSL_D(s2, s1, s2, 3); @@ -677,7 +675,7 @@ void iret_to_epilog(dynarec_la64_t* dyn, uintptr_t ip, int ninst, int is64bits) // set new RSP MV(xRSP, x3); // Ret.... - MOV64x(x2, (uintptr_t)la64_epilog); // epilog on purpose, CS might have changed! + MOV64x(x2, getConst(const_epilog)); // epilog on purpose, CS might have changed! SMEND(); BR(x2); CLEARIP(); @@ -708,7 +706,7 @@ void call_c(dynarec_la64_t* dyn, int ninst, la64_consts_t fnc, int reg, int ret, STORE_REG(RDI); ST_D(xRIP, xEmu, offsetof(x64emu_t, ip)); } - TABLE64(reg, getConst(fnc)); + TABLE64C(reg, fnc); JIRL(xRA, reg, 0); if (ret >= 0) { MV(ret, xEmu); diff --git a/src/dynarec/la64/dynarec_la64_helper.h b/src/dynarec/la64/dynarec_la64_helper.h index 223ac151..b75e1f84 100644 --- a/src/dynarec/la64/dynarec_la64_helper.h +++ b/src/dynarec/la64/dynarec_la64_helper.h @@ -1022,6 +1022,9 @@ #ifndef TABLE64 #define TABLE64(A, V) #endif +#ifndef TABLE64C +#define TABLE64C(A, V) +#endif #define ARCH_INIT() SMSTART() @@ -1071,10 +1074,6 @@ #define MODREG ((nextop & 0xC0) == 0xC0) -void la64_epilog(void); -void la64_epilog_fast(void); -void* la64_next(x64emu_t* emu, uintptr_t addr); - #ifndef STEPNAME #define STEPNAME3(N, M) N##M #define STEPNAME2(N, M) STEPNAME3(N, M) diff --git a/src/dynarec/la64/dynarec_la64_pass2.h b/src/dynarec/la64/dynarec_la64_pass2.h index 0d09b87d..9b5400d9 100644 --- a/src/dynarec/la64/dynarec_la64_pass2.h +++ b/src/dynarec/la64/dynarec_la64_pass2.h @@ -25,3 +25,9 @@ EMIT(0); \ EMIT(0); \ } +#define TABLE64C(A, V) \ + { \ + Table64(dyn, getConst(V), 2); \ + EMIT(0); \ + EMIT(0); \ + } diff --git a/src/dynarec/la64/dynarec_la64_pass3.h b/src/dynarec/la64/dynarec_la64_pass3.h index 92354bb7..7a21b637 100644 --- a/src/dynarec/la64/dynarec_la64_pass3.h +++ b/src/dynarec/la64/dynarec_la64_pass3.h @@ -31,3 +31,10 @@ PCADDU12I(A, SPLIT20(val64offset)); \ LD_D(A, A, SPLIT12(val64offset)); \ } +#define TABLE64C(A, V) \ + { \ + int val64offset = Table64(dyn, getConst(V), 3); \ + MESSAGE(LOG_DUMP, " Table64: 0x%lx\n", (V)); \ + PCADDU12I(A, SPLIT20(val64offset)); \ + LD_D(A, A, SPLIT12(val64offset)); \ + } |