github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/src/runtime/cgo/libcgo.h (about)

     1  // Copyright 2009 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  #include <stdint.h>
     6  #include <stdlib.h>
     7  #include <stdio.h>
     8  
     9  #define nil ((void*)0)
    10  #define nelem(x) (sizeof(x)/sizeof((x)[0]))
    11  
    12  typedef uint32_t uint32;
    13  typedef uint64_t uint64;
    14  typedef uintptr_t uintptr;
    15  
    16  /*
    17   * The beginning of the per-goroutine structure,
    18   * as defined in ../pkg/runtime/runtime.h.
    19   * Just enough to edit these two fields.
    20   */
    21  typedef struct G G;
    22  struct G
    23  {
    24  	uintptr stacklo;
    25  	uintptr stackhi;
    26  };
    27  
    28  /*
    29   * Arguments to the _cgo_thread_start call.
    30   * Also known to ../pkg/runtime/runtime.h.
    31   */
    32  typedef struct ThreadStart ThreadStart;
    33  struct ThreadStart
    34  {
    35  	G *g;
    36  	uintptr *tls;
    37  	void (*fn)(void);
    38  };
    39  
    40  /*
    41   * Called by 5c/6c/8c world.
    42   * Makes a local copy of the ThreadStart and
    43   * calls _cgo_sys_thread_start(ts).
    44   */
    45  extern void (*_cgo_thread_start)(ThreadStart *ts);
    46  
    47  /*
    48   * Creates the new operating system thread (OS, arch dependent).
    49   */
    50  void _cgo_sys_thread_start(ThreadStart *ts);
    51  
    52  /*
    53   * Call fn in the 6c world.
    54   */
    55  void crosscall_amd64(void (*fn)(void));
    56  
    57  /*
    58   * Call fn in the 8c world.
    59   */
    60  void crosscall_386(void (*fn)(void));
    61  
    62  /*
    63   * Prints error then calls abort. For linux and android.
    64   */
    65  void fatalf(const char* format, ...);