github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/engine/compiler/arch_arm64.s (about)

     1  #include "funcdata.h"
     2  #include "textflag.h"
     3  
     4  // nativecall(codeSegment, ce, moduleInstanceAddress)
     5  TEXT ·nativecall(SB), NOSPLIT|NOFRAME, $0-24
     6  	// Load the address of *callEngine into arm64ReservedRegisterForCallEngine.
     7  	MOVD ce+8(FP), R0
     8  
     9  	// In arm64, return address is stored in R30 after jumping into the code.
    10  	// We save the return address value into archContext.compilerReturnAddress in Engine.
    11  	// Note that the const 144 drifts after editting Engine or archContext struct. See TestArchContextOffsetInEngine.
    12  	MOVD R30, 144(R0)
    13  
    14  	// Load the address of *wasm.ModuleInstance into arm64CallingConventionModuleInstanceAddressRegister.
    15  	MOVD moduleInstanceAddress+16(FP), R29
    16  
    17  	// Load the address of native code.
    18  	MOVD codeSegment+0(FP), R1
    19  
    20  	// Jump to native code.
    21  	JMP (R1)