Source file src/runtime/defs_linux_mipsx.go

     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  //go:build (mips || mipsle) && linux
     6  
     7  package runtime
     8  
     9  import "unsafe"
    10  
    11  const (
    12  	_EINTR  = 0x4
    13  	_EAGAIN = 0xb
    14  	_ENOMEM = 0xc
    15  	_ENOSYS = 0x26
    16  
    17  	_PROT_NONE  = 0x0
    18  	_PROT_READ  = 0x1
    19  	_PROT_WRITE = 0x2
    20  	_PROT_EXEC  = 0x4
    21  
    22  	_MAP_ANON    = 0x800
    23  	_MAP_PRIVATE = 0x2
    24  	_MAP_FIXED   = 0x10
    25  
    26  	_MADV_DONTNEED   = 0x4
    27  	_MADV_FREE       = 0x8
    28  	_MADV_HUGEPAGE   = 0xe
    29  	_MADV_NOHUGEPAGE = 0xf
    30  	_MADV_COLLAPSE   = 0x19
    31  
    32  	_SA_RESTART = 0x10000000
    33  	_SA_ONSTACK = 0x8000000
    34  	_SA_SIGINFO = 0x8
    35  
    36  	_SI_KERNEL = 0x80
    37  	_SI_TIMER  = -0x2
    38  
    39  	_SIGHUP    = 0x1
    40  	_SIGINT    = 0x2
    41  	_SIGQUIT   = 0x3
    42  	_SIGILL    = 0x4
    43  	_SIGTRAP   = 0x5
    44  	_SIGABRT   = 0x6
    45  	_SIGEMT    = 0x7
    46  	_SIGFPE    = 0x8
    47  	_SIGKILL   = 0x9
    48  	_SIGBUS    = 0xa
    49  	_SIGSEGV   = 0xb
    50  	_SIGSYS    = 0xc
    51  	_SIGPIPE   = 0xd
    52  	_SIGALRM   = 0xe
    53  	_SIGUSR1   = 0x10
    54  	_SIGUSR2   = 0x11
    55  	_SIGCHLD   = 0x12
    56  	_SIGPWR    = 0x13
    57  	_SIGWINCH  = 0x14
    58  	_SIGURG    = 0x15
    59  	_SIGIO     = 0x16
    60  	_SIGSTOP   = 0x17
    61  	_SIGTSTP   = 0x18
    62  	_SIGCONT   = 0x19
    63  	_SIGTTIN   = 0x1a
    64  	_SIGTTOU   = 0x1b
    65  	_SIGVTALRM = 0x1c
    66  	_SIGPROF   = 0x1d
    67  	_SIGXCPU   = 0x1e
    68  	_SIGXFSZ   = 0x1f
    69  
    70  	_SIGRTMIN = 0x20
    71  
    72  	_FPE_INTDIV = 0x1
    73  	_FPE_INTOVF = 0x2
    74  	_FPE_FLTDIV = 0x3
    75  	_FPE_FLTOVF = 0x4
    76  	_FPE_FLTUND = 0x5
    77  	_FPE_FLTRES = 0x6
    78  	_FPE_FLTINV = 0x7
    79  	_FPE_FLTSUB = 0x8
    80  
    81  	_BUS_ADRALN = 0x1
    82  	_BUS_ADRERR = 0x2
    83  	_BUS_OBJERR = 0x3
    84  
    85  	_SEGV_MAPERR = 0x1
    86  	_SEGV_ACCERR = 0x2
    87  
    88  	_ITIMER_REAL    = 0x0
    89  	_ITIMER_VIRTUAL = 0x1
    90  	_ITIMER_PROF    = 0x2
    91  
    92  	_CLOCK_THREAD_CPUTIME_ID = 0x3
    93  
    94  	_SIGEV_THREAD_ID = 0x4
    95  )
    96  
    97  // The timespec structs and types are defined in Linux in
    98  // include/uapi/linux/time_types.h and include/uapi/asm-generic/posix_types.h.
    99  type timespec32 struct {
   100  	tv_sec  int32
   101  	tv_nsec int32
   102  }
   103  
   104  //go:nosplit
   105  func (ts *timespec32) setNsec(ns int64) {
   106  	ts.tv_sec = int32(ns / 1e9)
   107  	ts.tv_nsec = int32(ns % 1e9)
   108  }
   109  
   110  type timespec struct {
   111  	tv_sec  int64
   112  	tv_nsec int64
   113  }
   114  
   115  //go:nosplit
   116  func (ts *timespec) setNsec(ns int64) {
   117  	ts.tv_sec = int64(ns / 1e9)
   118  	ts.tv_nsec = int64(ns % 1e9)
   119  }
   120  
   121  type timeval struct {
   122  	tv_sec  int32
   123  	tv_usec int32
   124  }
   125  
   126  //go:nosplit
   127  func (tv *timeval) set_usec(x int32) {
   128  	tv.tv_usec = x
   129  }
   130  
   131  type sigactiont struct {
   132  	sa_flags   uint32
   133  	sa_handler uintptr
   134  	sa_mask    [4]uint32
   135  	// linux header does not have sa_restorer field,
   136  	// but it is used in setsig(). it is no harm to put it here
   137  	sa_restorer uintptr
   138  }
   139  
   140  type siginfoFields struct {
   141  	si_signo int32
   142  	si_code  int32
   143  	si_errno int32
   144  	// below here is a union; si_addr is the only field we use
   145  	si_addr uint32
   146  }
   147  
   148  type siginfo struct {
   149  	siginfoFields
   150  
   151  	// Pad struct to the max size in the kernel.
   152  	_ [_si_max_size - unsafe.Sizeof(siginfoFields{})]byte
   153  }
   154  
   155  type itimerspec32 struct {
   156  	it_interval timespec32
   157  	it_value    timespec32
   158  }
   159  
   160  type itimerspec struct {
   161  	it_interval timespec
   162  	it_value    timespec
   163  }
   164  
   165  type itimerval struct {
   166  	it_interval timeval
   167  	it_value    timeval
   168  }
   169  
   170  type sigeventFields struct {
   171  	value  uintptr
   172  	signo  int32
   173  	notify int32
   174  	// below here is a union; sigev_notify_thread_id is the only field we use
   175  	sigev_notify_thread_id int32
   176  }
   177  
   178  type sigevent struct {
   179  	sigeventFields
   180  
   181  	// Pad struct to the max size in the kernel.
   182  	_ [_sigev_max_size - unsafe.Sizeof(sigeventFields{})]byte
   183  }
   184  
   185  const (
   186  	_O_RDONLY    = 0x0
   187  	_O_WRONLY    = 0x1
   188  	_O_NONBLOCK  = 0x80
   189  	_O_CREAT     = 0x100
   190  	_O_TRUNC     = 0x200
   191  	_O_CLOEXEC   = 0x80000
   192  	_SA_RESTORER = 0
   193  )
   194  
   195  type stackt struct {
   196  	ss_sp    *byte
   197  	ss_size  uintptr
   198  	ss_flags int32
   199  }
   200  
   201  type sigcontext struct {
   202  	sc_regmask   uint32
   203  	sc_status    uint32
   204  	sc_pc        uint64
   205  	sc_regs      [32]uint64
   206  	sc_fpregs    [32]uint64
   207  	sc_acx       uint32
   208  	sc_fpc_csr   uint32
   209  	sc_fpc_eir   uint32
   210  	sc_used_math uint32
   211  	sc_dsp       uint32
   212  	sc_mdhi      uint64
   213  	sc_mdlo      uint64
   214  	sc_hi1       uint32
   215  	sc_lo1       uint32
   216  	sc_hi2       uint32
   217  	sc_lo2       uint32
   218  	sc_hi3       uint32
   219  	sc_lo3       uint32
   220  }
   221  
   222  type ucontext struct {
   223  	uc_flags    uint32
   224  	uc_link     *ucontext
   225  	uc_stack    stackt
   226  	Pad_cgo_0   [4]byte
   227  	uc_mcontext sigcontext
   228  	uc_sigmask  [4]uint32
   229  }
   230  

View as plain text