github.com/notti/nocgo@v0.0.0-20190619201224-fc443047424c/internal/fakecgo/godefs.go (about)

     1  package fakecgo
     2  
     3  import "unsafe"
     4  
     5  //go:linkname memmove runtime.memmove
     6  func memmove(to, from unsafe.Pointer, n uintptr)
     7  
     8  //go:linkname funcPC runtime.funcPC
     9  func funcPC(f interface{}) uintptr
    10  
    11  // the following struct is cgothreadstart from runtime
    12  type threadstart struct {
    13  	g   unsafe.Pointer //should be guintptr
    14  	tls *uint64
    15  	fn  unsafe.Pointer
    16  }
    17  
    18  // just enough from the runtime to manipulate g->stack->lo/hi
    19  type stack struct {
    20  	lo uintptr
    21  	hi uintptr
    22  }
    23  
    24  type g struct {
    25  	stack stack
    26  }
    27  
    28  // We actually don't need the full thing - but this is the same as in runtime and makes possible integration simpler
    29  type libcall struct {
    30  	fn   uintptr
    31  	n    uintptr
    32  	args uintptr
    33  	r1   uintptr
    34  	r2   uintptr
    35  	err  uintptr
    36  }
    37  
    38  type libcFunc uintptr