github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.s (about) 1 //go:build arm64 2 3 #include "funcdata.h" 4 #include "textflag.h" 5 6 // See the comments on EmitGoEntryPreamble for what this function is supposed to do. 7 TEXT ·entrypoint(SB), NOSPLIT|NOFRAME, $0-48 8 MOVD preambleExecutable+0(FP), R27 9 MOVD functionExectuable+8(FP), R24 10 MOVD executionContextPtr+16(FP), R0 11 MOVD moduleContextPtr+24(FP), R1 12 MOVD paramResultSlicePtr+32(FP), R19 13 MOVD goAllocatedStackSlicePtr+40(FP), R26 14 JMP (R27) 15 16 TEXT ·afterGoFunctionCallEntrypoint(SB), NOSPLIT|NOFRAME, $0-24 17 MOVD goCallReturnAddress+0(FP), R20 18 MOVD executionContextPtr+8(FP), R0 19 MOVD stackPointer+16(FP), R19 20 21 // Save the current FP(R29), SP and LR(R30) into the wazevo.executionContext (stored in R0). 22 MOVD R29, 16(R0) // Store FP(R29) into [RO, #ExecutionContextOffsets.OriginalFramePointer] 23 MOVD RSP, R27 // Move SP to R27 (temporary register) since SP cannot be stored directly in str instructions. 24 MOVD R27, 24(R0) // Store R27 into [RO, #ExecutionContextOffsets.OriginalFramePointer] 25 MOVD R30, 32(R0) // Store R30 into [R0, #ExecutionContextOffsets.GoReturnAddress] 26 27 // Load the new stack pointer (which sits somewhere in Go-allocated stack) into SP. 28 MOVD R19, RSP 29 JMP (R20)