Home | History | Annotate | Download | only in runtime
      1 // Note: cgo can't handle some Darwin/ARM structures, so this file can't
      2 // be auto generated by cgo yet.
      3 // Created based on output of `cgo -cdefs defs_darwin.go` and Darwin/ARM
      4 // specific header (mainly mcontext and ucontext related stuff)
      5 
      6 package runtime
      7 
      8 import "unsafe"
      9 
     10 const (
     11 	_EINTR  = 0x4
     12 	_EFAULT = 0xe
     13 
     14 	_PROT_NONE  = 0x0
     15 	_PROT_READ  = 0x1
     16 	_PROT_WRITE = 0x2
     17 	_PROT_EXEC  = 0x4
     18 
     19 	_MAP_ANON    = 0x1000
     20 	_MAP_PRIVATE = 0x2
     21 	_MAP_FIXED   = 0x10
     22 
     23 	_MADV_DONTNEED = 0x4
     24 	_MADV_FREE     = 0x5
     25 
     26 	_MACH_MSG_TYPE_MOVE_RECEIVE   = 0x10
     27 	_MACH_MSG_TYPE_MOVE_SEND      = 0x11
     28 	_MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12
     29 	_MACH_MSG_TYPE_COPY_SEND      = 0x13
     30 	_MACH_MSG_TYPE_MAKE_SEND      = 0x14
     31 	_MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15
     32 	_MACH_MSG_TYPE_COPY_RECEIVE   = 0x16
     33 
     34 	_MACH_MSG_PORT_DESCRIPTOR         = 0x0
     35 	_MACH_MSG_OOL_DESCRIPTOR          = 0x1
     36 	_MACH_MSG_OOL_PORTS_DESCRIPTOR    = 0x2
     37 	_MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3
     38 
     39 	_MACH_MSGH_BITS_COMPLEX = 0x80000000
     40 
     41 	_MACH_SEND_MSG  = 0x1
     42 	_MACH_RCV_MSG   = 0x2
     43 	_MACH_RCV_LARGE = 0x4
     44 
     45 	_MACH_SEND_TIMEOUT   = 0x10
     46 	_MACH_SEND_INTERRUPT = 0x40
     47 	_MACH_SEND_ALWAYS    = 0x10000
     48 	_MACH_SEND_TRAILER   = 0x20000
     49 	_MACH_RCV_TIMEOUT    = 0x100
     50 	_MACH_RCV_NOTIFY     = 0x200
     51 	_MACH_RCV_INTERRUPT  = 0x400
     52 	_MACH_RCV_OVERWRITE  = 0x1000
     53 
     54 	_NDR_PROTOCOL_2_0      = 0x0
     55 	_NDR_INT_BIG_ENDIAN    = 0x0
     56 	_NDR_INT_LITTLE_ENDIAN = 0x1
     57 	_NDR_FLOAT_IEEE        = 0x0
     58 	_NDR_CHAR_ASCII        = 0x0
     59 
     60 	_SA_SIGINFO   = 0x40
     61 	_SA_RESTART   = 0x2
     62 	_SA_ONSTACK   = 0x1
     63 	_SA_USERTRAMP = 0x100
     64 	_SA_64REGSET  = 0x200
     65 
     66 	_SIGHUP    = 0x1
     67 	_SIGINT    = 0x2
     68 	_SIGQUIT   = 0x3
     69 	_SIGILL    = 0x4
     70 	_SIGTRAP   = 0x5
     71 	_SIGABRT   = 0x6
     72 	_SIGEMT    = 0x7
     73 	_SIGFPE    = 0x8
     74 	_SIGKILL   = 0x9
     75 	_SIGBUS    = 0xa
     76 	_SIGSEGV   = 0xb
     77 	_SIGSYS    = 0xc
     78 	_SIGPIPE   = 0xd
     79 	_SIGALRM   = 0xe
     80 	_SIGTERM   = 0xf
     81 	_SIGURG    = 0x10
     82 	_SIGSTOP   = 0x11
     83 	_SIGTSTP   = 0x12
     84 	_SIGCONT   = 0x13
     85 	_SIGCHLD   = 0x14
     86 	_SIGTTIN   = 0x15
     87 	_SIGTTOU   = 0x16
     88 	_SIGIO     = 0x17
     89 	_SIGXCPU   = 0x18
     90 	_SIGXFSZ   = 0x19
     91 	_SIGVTALRM = 0x1a
     92 	_SIGPROF   = 0x1b
     93 	_SIGWINCH  = 0x1c
     94 	_SIGINFO   = 0x1d
     95 	_SIGUSR1   = 0x1e
     96 	_SIGUSR2   = 0x1f
     97 
     98 	_FPE_INTDIV = 0x7
     99 	_FPE_INTOVF = 0x8
    100 	_FPE_FLTDIV = 0x1
    101 	_FPE_FLTOVF = 0x2
    102 	_FPE_FLTUND = 0x3
    103 	_FPE_FLTRES = 0x4
    104 	_FPE_FLTINV = 0x5
    105 	_FPE_FLTSUB = 0x6
    106 
    107 	_BUS_ADRALN = 0x1
    108 	_BUS_ADRERR = 0x2
    109 	_BUS_OBJERR = 0x3
    110 
    111 	_SEGV_MAPERR = 0x1
    112 	_SEGV_ACCERR = 0x2
    113 
    114 	_ITIMER_REAL    = 0x0
    115 	_ITIMER_VIRTUAL = 0x1
    116 	_ITIMER_PROF    = 0x2
    117 
    118 	_EV_ADD       = 0x1
    119 	_EV_DELETE    = 0x2
    120 	_EV_CLEAR     = 0x20
    121 	_EV_RECEIPT   = 0x40
    122 	_EV_ERROR     = 0x4000
    123 	_EV_EOF       = 0x8000
    124 	_EVFILT_READ  = -0x1
    125 	_EVFILT_WRITE = -0x2
    126 )
    127 
    128 type machbody struct {
    129 	msgh_descriptor_count uint32
    130 }
    131 
    132 type machheader struct {
    133 	msgh_bits        uint32
    134 	msgh_size        uint32
    135 	msgh_remote_port uint32
    136 	msgh_local_port  uint32
    137 	msgh_reserved    uint32
    138 	msgh_id          int32
    139 }
    140 
    141 type machndr struct {
    142 	mig_vers     uint8
    143 	if_vers      uint8
    144 	reserved1    uint8
    145 	mig_encoding uint8
    146 	int_rep      uint8
    147 	char_rep     uint8
    148 	float_rep    uint8
    149 	reserved2    uint8
    150 }
    151 
    152 type machport struct {
    153 	name        uint32
    154 	pad1        uint32
    155 	pad2        uint16
    156 	disposition uint8
    157 	_type       uint8
    158 }
    159 
    160 type stackt struct {
    161 	ss_sp    *byte
    162 	ss_size  uintptr
    163 	ss_flags int32
    164 }
    165 
    166 type sigactiont struct {
    167 	__sigaction_u [4]byte
    168 	sa_tramp      unsafe.Pointer
    169 	sa_mask       uint32
    170 	sa_flags      int32
    171 }
    172 
    173 type usigactiont struct {
    174 	__sigaction_u [4]byte
    175 	sa_mask       uint32
    176 	sa_flags      int32
    177 }
    178 
    179 type siginfo struct {
    180 	si_signo  int32
    181 	si_errno  int32
    182 	si_code   int32
    183 	si_pid    int32
    184 	si_uid    uint32
    185 	si_status int32
    186 	si_addr   uint32
    187 	si_value  [4]byte
    188 	si_band   int32
    189 	__pad     [7]uint32
    190 }
    191 
    192 type timeval struct {
    193 	tv_sec  int32
    194 	tv_usec int32
    195 }
    196 
    197 func (tv *timeval) set_usec(x int32) {
    198 	tv.tv_usec = x
    199 }
    200 
    201 type itimerval struct {
    202 	it_interval timeval
    203 	it_value    timeval
    204 }
    205 
    206 type timespec struct {
    207 	tv_sec  int32
    208 	tv_nsec int32
    209 }
    210 
    211 type floatstate32 struct {
    212 	r     [32]uint32
    213 	fpscr uint32
    214 }
    215 
    216 type regs32 struct {
    217 	r    [13]uint32 // r0 to r12
    218 	sp   uint32     // r13
    219 	lr   uint32     // r14
    220 	pc   uint32     // r15
    221 	cpsr uint32
    222 }
    223 
    224 type exceptionstate32 struct {
    225 	trapno     uint32 // NOTE: on 386, the trapno field is split into trapno and cpu
    226 	err        uint32
    227 	faultvaddr uint32
    228 }
    229 
    230 type mcontext32 struct {
    231 	es exceptionstate32
    232 	ss regs32
    233 	fs floatstate32
    234 }
    235 
    236 type ucontext struct {
    237 	uc_onstack  int32
    238 	uc_sigmask  uint32
    239 	uc_stack    stackt
    240 	uc_link     *ucontext
    241 	uc_mcsize   uint32
    242 	uc_mcontext *mcontext32
    243 }
    244 
    245 type keventt struct {
    246 	ident  uint32
    247 	filter int16
    248 	flags  uint16
    249 	fflags uint32
    250 	data   int32
    251 	udata  *byte
    252 }
    253