Home | History | Annotate | Download | only in runtime
      1 // Copyright 2016 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 mips mipsle
      6 // +build linux
      7 
      8 package runtime
      9 
     10 const (
     11 	_EINTR  = 0x4
     12 	_EAGAIN = 0xb
     13 	_ENOMEM = 0xc
     14 
     15 	_PROT_NONE  = 0x0
     16 	_PROT_READ  = 0x1
     17 	_PROT_WRITE = 0x2
     18 	_PROT_EXEC  = 0x4
     19 
     20 	_MAP_ANON    = 0x800
     21 	_MAP_PRIVATE = 0x2
     22 	_MAP_FIXED   = 0x10
     23 
     24 	_MADV_DONTNEED   = 0x4
     25 	_MADV_HUGEPAGE   = 0xe
     26 	_MADV_NOHUGEPAGE = 0xf
     27 
     28 	_SA_RESTART = 0x10000000
     29 	_SA_ONSTACK = 0x8000000
     30 	_SA_SIGINFO = 0x8
     31 
     32 	_SIGHUP    = 0x1
     33 	_SIGINT    = 0x2
     34 	_SIGQUIT   = 0x3
     35 	_SIGILL    = 0x4
     36 	_SIGTRAP   = 0x5
     37 	_SIGABRT   = 0x6
     38 	_SIGEMT    = 0x7
     39 	_SIGFPE    = 0x8
     40 	_SIGKILL   = 0x9
     41 	_SIGBUS    = 0xa
     42 	_SIGSEGV   = 0xb
     43 	_SIGSYS    = 0xc
     44 	_SIGPIPE   = 0xd
     45 	_SIGALRM   = 0xe
     46 	_SIGUSR1   = 0x10
     47 	_SIGUSR2   = 0x11
     48 	_SIGCHLD   = 0x12
     49 	_SIGPWR    = 0x13
     50 	_SIGWINCH  = 0x14
     51 	_SIGURG    = 0x15
     52 	_SIGIO     = 0x16
     53 	_SIGSTOP   = 0x17
     54 	_SIGTSTP   = 0x18
     55 	_SIGCONT   = 0x19
     56 	_SIGTTIN   = 0x1a
     57 	_SIGTTOU   = 0x1b
     58 	_SIGVTALRM = 0x1c
     59 	_SIGPROF   = 0x1d
     60 	_SIGXCPU   = 0x1e
     61 	_SIGXFSZ   = 0x1f
     62 
     63 	_FPE_INTDIV = 0x1
     64 	_FPE_INTOVF = 0x2
     65 	_FPE_FLTDIV = 0x3
     66 	_FPE_FLTOVF = 0x4
     67 	_FPE_FLTUND = 0x5
     68 	_FPE_FLTRES = 0x6
     69 	_FPE_FLTINV = 0x7
     70 	_FPE_FLTSUB = 0x8
     71 
     72 	_BUS_ADRALN = 0x1
     73 	_BUS_ADRERR = 0x2
     74 	_BUS_OBJERR = 0x3
     75 
     76 	_SEGV_MAPERR = 0x1
     77 	_SEGV_ACCERR = 0x2
     78 
     79 	_ITIMER_REAL    = 0x0
     80 	_ITIMER_VIRTUAL = 0x1
     81 	_ITIMER_PROF    = 0x2
     82 
     83 	_EPOLLIN       = 0x1
     84 	_EPOLLOUT      = 0x4
     85 	_EPOLLERR      = 0x8
     86 	_EPOLLHUP      = 0x10
     87 	_EPOLLRDHUP    = 0x2000
     88 	_EPOLLET       = 0x80000000
     89 	_EPOLL_CLOEXEC = 0x80000
     90 	_EPOLL_CTL_ADD = 0x1
     91 	_EPOLL_CTL_DEL = 0x2
     92 	_EPOLL_CTL_MOD = 0x3
     93 )
     94 
     95 type timespec struct {
     96 	tv_sec  int32
     97 	tv_nsec int32
     98 }
     99 
    100 //go:nosplit
    101 func (ts *timespec) set_sec(x int64) {
    102 	ts.tv_sec = int32(x)
    103 }
    104 
    105 //go:nosplit
    106 func (ts *timespec) set_nsec(x int32) {
    107 	ts.tv_nsec = x
    108 }
    109 
    110 type timeval struct {
    111 	tv_sec  int32
    112 	tv_usec int32
    113 }
    114 
    115 //go:nosplit
    116 func (tv *timeval) set_usec(x int32) {
    117 	tv.tv_usec = x
    118 }
    119 
    120 type sigactiont struct {
    121 	sa_flags   uint32
    122 	sa_handler uintptr
    123 	sa_mask    [4]uint32
    124 	// linux header does not have sa_restorer field,
    125 	// but it is used in setsig(). it is no harm to put it here
    126 	sa_restorer uintptr
    127 }
    128 
    129 type siginfo struct {
    130 	si_signo int32
    131 	si_code  int32
    132 	si_errno int32
    133 	// below here is a union; si_addr is the only field we use
    134 	si_addr uint32
    135 }
    136 
    137 type itimerval struct {
    138 	it_interval timeval
    139 	it_value    timeval
    140 }
    141 
    142 type epollevent struct {
    143 	events    uint32
    144 	pad_cgo_0 [4]byte
    145 	data      uint64
    146 }
    147 
    148 const (
    149 	_O_RDONLY    = 0x0
    150 	_O_CLOEXEC   = 0x80000
    151 	_SA_RESTORER = 0
    152 )
    153 
    154 type stackt struct {
    155 	ss_sp    *byte
    156 	ss_size  uintptr
    157 	ss_flags int32
    158 }
    159 
    160 type sigcontext struct {
    161 	sc_regmask   uint32
    162 	sc_status    uint32
    163 	sc_pc        uint64
    164 	sc_regs      [32]uint64
    165 	sc_fpregs    [32]uint64
    166 	sc_acx       uint32
    167 	sc_fpc_csr   uint32
    168 	sc_fpc_eir   uint32
    169 	sc_used_math uint32
    170 	sc_dsp       uint32
    171 	sc_mdhi      uint64
    172 	sc_mdlo      uint64
    173 	sc_hi1       uint32
    174 	sc_lo1       uint32
    175 	sc_hi2       uint32
    176 	sc_lo2       uint32
    177 	sc_hi3       uint32
    178 	sc_lo3       uint32
    179 }
    180 
    181 type ucontext struct {
    182 	uc_flags    uint32
    183 	uc_link     *ucontext
    184 	uc_stack    stackt
    185 	Pad_cgo_0   [4]byte
    186 	uc_mcontext sigcontext
    187 	uc_sigmask  [4]uint32
    188 }
    189