github.com/primecitizens/pcz/std@v0.2.1/core/thread/asm_wasm.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  //go:build pcz && wasm
     5  
     6  #include "textflag.h"
     7  
     8  // func SetG(*stdgo.GHead)
     9  TEXT ·SetG(SB),NOSPLIT,$8-0
    10  	MOVD gp+0(FP), g
    11  	RET
    12  
    13  // func Topframe(arg, sp uintptr, fn func(uintptr))
    14  TEXT ·Topframe(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
    15  	MOVD arg+0(FP), R0
    16  	MOVD fn+16(FP), R1
    17  
    18  	I64Load sp+8(FP)
    19  	I32WrapI64
    20  	Set SP
    21  
    22  	MOVD R1, 0(SP)
    23  
    24  	Get SP
    25  	I32Const $8
    26  	I32Add
    27  	Set SP
    28  	
    29  	MOVD R0, 0(SP) // arg
    30  
    31  	Get R1
    32  	CALL // fn(arg)
    33  	RET