2015-03-08 07:20:20 -06:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package runtime
|
|
|
|
|
2017-03-16 21:31:09 -06:00
|
|
|
const (
|
2017-04-24 03:37:17 -06:00
|
|
|
_ARM64_FEATURE_HAS_CRC32 = 0x80
|
2017-03-16 21:31:09 -06:00
|
|
|
)
|
|
|
|
|
2015-03-08 07:20:20 -06:00
|
|
|
var randomNumber uint32
|
2017-03-16 21:31:09 -06:00
|
|
|
var supportCRC32 bool
|
2015-03-08 07:20:20 -06:00
|
|
|
|
2016-04-14 10:12:45 -06:00
|
|
|
func archauxv(tag, val uintptr) {
|
|
|
|
switch tag {
|
2016-04-14 10:32:28 -06:00
|
|
|
case _AT_RANDOM:
|
|
|
|
// sysargs filled in startupRandomData, but that
|
|
|
|
// pointer may not be word aligned, so we must treat
|
|
|
|
// it as a byte array.
|
2016-04-14 10:12:45 -06:00
|
|
|
randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
|
|
|
|
uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
|
2017-04-24 03:37:17 -06:00
|
|
|
case _AT_HWCAP:
|
|
|
|
supportCRC32 = val&_ARM64_FEATURE_HAS_CRC32 != 0
|
2016-04-05 21:09:39 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-15 03:11:47 -06:00
|
|
|
//go:nosplit
|
2015-03-08 07:20:20 -06:00
|
|
|
func cputicks() int64 {
|
2016-06-28 10:22:46 -06:00
|
|
|
// Currently cputicks() is used in blocking profiler and to seed fastrand().
|
2015-03-08 07:20:20 -06:00
|
|
|
// nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
|
2016-06-28 10:22:46 -06:00
|
|
|
// randomNumber provides better seeding of fastrand.
|
2015-03-08 07:20:20 -06:00
|
|
|
return nanotime() + int64(randomNumber)
|
|
|
|
}
|