...
Run Format

Source file src/runtime/os_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  // +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  )
    39  
    40  type sigset [4]uint32
    41  
    42  var sigset_all = sigset{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)}
    43  
    44  //go:nosplit
    45  //go:nowritebarrierrec
    46  func sigaddset(mask *sigset, i int) {
    47  	(*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31)
    48  }
    49  
    50  func sigdelset(mask *sigset, i int) {
    51  	(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
    52  }
    53  
    54  func sigfillset(mask *[4]uint32) {
    55  	(*mask)[0], (*mask)[1], (*mask)[2], (*mask)[3] = ^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)
    56  }
    57  

View as plain text