github.com/likebike/go--@v0.0.0-20190911215757-0bd925d16e96/go/src/runtime/os_linux_mipsx.go (about)

     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 linux
     6  // +build mips mipsle
     7  
     8  package runtime
     9  
    10  var randomNumber uint32
    11  
    12  func archauxv(tag, val uintptr) {
    13  	switch tag {
    14  	case _AT_RANDOM:
    15  		// sysargs filled in startupRandomData, but that
    16  		// pointer may not be word aligned, so we must treat
    17  		// it as a byte array.
    18  		randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
    19  			uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
    20  	}
    21  }
    22  
    23  //go:nosplit
    24  func cputicks() int64 {
    25  	// Currently cputicks() is used in blocking profiler and to seed fastrand().
    26  	// nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
    27  	// randomNumber provides better seeding of fastrand1.
    28  	return nanotime() + int64(randomNumber)
    29  }
    30  
    31  const (
    32  	_SS_DISABLE  = 2
    33  	_NSIG        = 128 + 1
    34  	_SI_USER     = 0
    35  	_SIG_BLOCK   = 1
    36  	_SIG_UNBLOCK = 2
    37  	_SIG_SETMASK = 3
    38  	_RLIMIT_AS   = 6
    39  )
    40  
    41  type sigset [4]uint32
    42  
    43  type rlimit struct {
    44  	rlim_cur uintptr
    45  	rlim_max uintptr
    46  }
    47  
    48  var sigset_all = sigset{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)}
    49  
    50  //go:nosplit
    51  //go:nowritebarrierrec
    52  func sigaddset(mask *sigset, i int) {
    53  	(*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31)
    54  }
    55  
    56  func sigdelset(mask *sigset, i int) {
    57  	(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
    58  }
    59  
    60  func sigfillset(mask *[4]uint32) {
    61  	(*mask)[0], (*mask)[1], (*mask)[2], (*mask)[3] = ^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)
    62  }