github.com/aloncn/graphics-go@v0.0.1/src/runtime/cgo/signal_darwin_armx.go (about)

     1  // Copyright 2015 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  // +build darwin
     6  // +build arm arm64
     7  
     8  package cgo
     9  
    10  import "unsafe"
    11  
    12  //go:cgo_import_static x_cgo_panicmem
    13  //go:linkname x_cgo_panicmem x_cgo_panicmem
    14  var x_cgo_panicmem uintptr
    15  
    16  // TODO(crawshaw): move this into x_cgo_init, it will not run until
    17  // runtime has finished loading, which may be after its use.
    18  func init() {
    19  	x_cgo_panicmem = funcPC(panicmem)
    20  }
    21  
    22  func funcPC(f interface{}) uintptr {
    23  	var ptrSize = unsafe.Sizeof(uintptr(0))
    24  	return **(**uintptr)(add(unsafe.Pointer(&f), ptrSize))
    25  }
    26  
    27  func add(p unsafe.Pointer, x uintptr) unsafe.Pointer {
    28  	return unsafe.Pointer(uintptr(p) + x)
    29  }
    30  
    31  func panicmem()