blob: e3cff68c6b85bd6e886ea1de8b6b8d6195e35e58 [file] [log] [blame]
// Copyright 2018 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.
// +build freebsd
// +build 386 amd64
package runtime
const (
_VDSO_TH_ALGO_X86_TSC = 1
)
//go:nosplit
func (th *vdsoTimehands) getTSCTimecounter() uint32 {
tsc := cputicks()
if th.x86_shift > 0 {
tsc >>= th.x86_shift
}
return uint32(tsc)
}
//go:nosplit
func (th *vdsoTimehands) getTimecounter() (uint32, bool) {
switch th.algo {
case _VDSO_TH_ALGO_X86_TSC:
return th.getTSCTimecounter(), true
default:
return 0, false
}
}