github.com/AESNooper/go/src@v0.0.0-20220218095104-b56a4ab1bbbb/runtime/sys_wasm.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  import (
     8  	"internal/goarch"
     9  	"runtime/internal/sys"
    10  	"unsafe"
    11  )
    12  
    13  type m0Stack struct {
    14  	_ [8192 * sys.StackGuardMultiplier]byte
    15  }
    16  
    17  var wasmStack m0Stack
    18  
    19  func wasmMove()
    20  
    21  func wasmZero()
    22  
    23  func wasmDiv()
    24  
    25  func wasmTruncS()
    26  func wasmTruncU()
    27  
    28  func wasmExit(code int32)
    29  
    30  // adjust Gobuf as it if executed a call to fn with context ctxt
    31  // and then stopped before the first instruction in fn.
    32  func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
    33  	sp := buf.sp
    34  	sp -= goarch.PtrSize
    35  	*(*uintptr)(unsafe.Pointer(sp)) = buf.pc
    36  	buf.sp = sp
    37  	buf.pc = uintptr(fn)
    38  	buf.ctxt = ctxt
    39  }