...

Source file src/runtime/defs_linux_mipsx.go

Documentation: 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  //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 = 0x59
    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 int32
   113  	_       [4]byte // the C ABI aligns int64 to 8 bytes
   114  }
   115  
   116  //go:nosplit
   117  func (ts *timespec) setNsec(ns int64) {
   118  	ts.tv_sec = ns / 1e9
   119  	ts.tv_nsec = int32(ns % 1e9)
   120  }
   121  
   122  type timeval struct {
   123  	tv_sec  int32
   124  	tv_usec int32
   125  }
   126  
   127  //go:nosplit
   128  func (tv *timeval) set_usec(x int32) {
   129  	tv.tv_usec = x
   130  }
   131  
   132  type sigactiont struct {
   133  	sa_flags   uint32
   134  	sa_handler uintptr
   135  	sa_mask    [4]uint32
   136  	// linux header does not have sa_restorer field,
   137  	// but it is used in setsig(). it is no harm to put it here
   138  	sa_restorer uintptr
   139  }
   140  
   141  type siginfoFields struct {
   142  	si_signo int32
   143  	si_code  int32
   144  	si_errno int32
   145  	// below here is a union; si_addr is the only field we use
   146  	si_addr uint32
   147  }
   148  
   149  type siginfo struct {
   150  	siginfoFields
   151  
   152  	// Pad struct to the max size in the kernel.
   153  	_ [_si_max_size - unsafe.Sizeof(siginfoFields{})]byte
   154  }
   155  
   156  type itimerspec32 struct {
   157  	it_interval timespec32
   158  	it_value    timespec32
   159  }
   160  
   161  type itimerspec struct {
   162  	it_interval timespec
   163  	it_value    timespec
   164  }
   165  
   166  type itimerval struct {
   167  	it_interval timeval
   168  	it_value    timeval
   169  }
   170  
   171  type sigeventFields struct {
   172  	value  uintptr
   173  	signo  int32
   174  	notify int32
   175  	// below here is a union; sigev_notify_thread_id is the only field we use
   176  	sigev_notify_thread_id int32
   177  }
   178  
   179  type sigevent struct {
   180  	sigeventFields
   181  
   182  	// Pad struct to the max size in the kernel.
   183  	_ [_sigev_max_size - unsafe.Sizeof(sigeventFields{})]byte
   184  }
   185  
   186  const (
   187  	_O_RDONLY    = 0x0
   188  	_O_WRONLY    = 0x1
   189  	_O_NONBLOCK  = 0x80
   190  	_O_CREAT     = 0x100
   191  	_O_TRUNC     = 0x200
   192  	_O_CLOEXEC   = 0x80000
   193  	_SA_RESTORER = 0
   194  )
   195  
   196  type stackt struct {
   197  	ss_sp    *byte
   198  	ss_size  uintptr
   199  	ss_flags int32
   200  }
   201  
   202  type sigcontext struct {
   203  	sc_regmask   uint32
   204  	sc_status    uint32
   205  	sc_pc        uint64
   206  	sc_regs      [32]uint64
   207  	sc_fpregs    [32]uint64
   208  	sc_acx       uint32
   209  	sc_fpc_csr   uint32
   210  	sc_fpc_eir   uint32
   211  	sc_used_math uint32
   212  	sc_dsp       uint32
   213  	sc_mdhi      uint64
   214  	sc_mdlo      uint64
   215  	sc_hi1       uint32
   216  	sc_lo1       uint32
   217  	sc_hi2       uint32
   218  	sc_lo2       uint32
   219  	sc_hi3       uint32
   220  	sc_lo3       uint32
   221  }
   222  
   223  type ucontext struct {
   224  	uc_flags    uint32
   225  	uc_link     *ucontext
   226  	uc_stack    stackt
   227  	Pad_cgo_0   [4]byte
   228  	uc_mcontext sigcontext
   229  	uc_sigmask  [4]uint32
   230  }
   231  

View as plain text