feat(asm): encode indirect JMP and CALL on all four architectures
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// ABI0 JIT trampoline for LoongArch 64.
|
||||
//
|
||||
// enterJIT saves Go SP and RA (R1), switches to the prepared stack, and
|
||||
// jumps to the JIT function. When the function RETs (JIRL zero, ra, 0),
|
||||
// jumps to the JIT function. When the function RETs (JMP (R1), the toolchain's spelling for jirl zero, ra, 0),
|
||||
// control lands in leaveJIT.
|
||||
|
||||
// func enterJIT(fn uintptr, stack uintptr)
|
||||
@@ -19,14 +19,14 @@ TEXT ·enterJIT(SB), NOSPLIT, $0-16
|
||||
MOVV R5, R3 // switch to the prepared stack: SP stays on
|
||||
// the leave slot, so the kernel reads its
|
||||
// first argument at SP+8
|
||||
JIRL R0, R4, 0 // jump to JIT function
|
||||
JMP (R4) // jump to JIT function
|
||||
|
||||
// func leaveJIT()
|
||||
TEXT ·leaveJIT(SB), NOSPLIT, $0-0
|
||||
MOVV savedSP(SB), R5 // restore Go stack pointer
|
||||
MOVV R5, R3 // restore SP
|
||||
MOVV savedRA(SB), R1 // restore return address
|
||||
JIRL R0, R1, 0 // return to Go caller
|
||||
JMP (R1) // return to Go caller
|
||||
|
||||
GLOBL savedRA(SB), NOPTR, $8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user