| 1 |
#include "funcdata.h" |
| 2 |
#include "textflag.h" |
| 3 |
|
| 4 |
// entrypoint(preambleExecutable, functionExecutable *byte, executionContextPtr uintptr, moduleContextPtr *byte, paramResultPtr *uint64, goAllocatedStackSlicePtr uintptr |
| 5 |
TEXT ·entrypoint(SB), NOSPLIT|NOFRAME, $0-48 |
| 6 |
MOVQ preambleExecutable+0(FP), R11 |
| 7 |
MOVQ functionExectuable+8(FP), R14 |
| 8 |
MOVQ executionContextPtr+16(FP), AX // First argument is passed in AX. |
| 9 |
MOVQ moduleContextPtr+24(FP), BX // Second argument is passed in BX. |
| 10 |
MOVQ paramResultSlicePtr+32(FP), R12 |
| 11 |
MOVQ goAllocatedStackSlicePtr+40(FP), R13 |
| 12 |
JMP R11 |
| 13 |
|
| 14 |
// afterGoFunctionCallEntrypoint(executable *byte, executionContextPtr uintptr, stackPointer, framePointer uintptr) |
| 15 |
TEXT ·afterGoFunctionCallEntrypoint(SB), NOSPLIT|NOFRAME, $0-32 |
| 16 |
MOVQ executable+0(FP), CX |
| 17 |
MOVQ executionContextPtr+8(FP), AX // First argument is passed in AX. |
| 18 |
|
| 19 |
// Save the stack pointer and frame pointer. |
| 20 |
MOVQ BP, 16(AX) // 16 == ExecutionContextOffsetOriginalFramePointer |
| 21 |
MOVQ SP, 24(AX) // 24 == ExecutionContextOffsetOriginalStackPointer |
| 22 |
|
| 23 |
// Then set the stack pointer and frame pointer to the values we got from the Go runtime. |
| 24 |
MOVQ framePointer+24(FP), BP |
| 25 |
|
| 26 |
// WARNING: do not update SP before BP, because the Go translates (FP) as (SP) + 8. |
| 27 |
MOVQ stackPointer+16(FP), SP |
| 28 |
|
| 29 |
JMP CX |