From 535fe2b226096a3547321a51b36f464ab443b5cb Mon Sep 17 00:00:00 2001 From: Yuval Pavel Zholkover Date: Fri, 12 Aug 2022 21:57:28 +0300 Subject: [PATCH] runtime: fast clock_gettime on FreeBSD, use physical/virtual ARM timer as setup by the kernel on GOARCH=arm64. Update #50947 Change-Id: I2f44be9b36e9ce8d264eccc0aa3df10825c5f4f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/422977 Reviewed-by: Heschi Kreinick Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Meng Zhuo Reviewed-by: Dmitri Goutnik Run-TryBot: Yuval Pavel Zholkover --- src/runtime/sys_freebsd_arm64.s | 2 +- src/runtime/vdso_freebsd_arm64.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/sys_freebsd_arm64.s b/src/runtime/sys_freebsd_arm64.s index 5dcdf375ab5c63..cb960773ebeed3 100644 --- a/src/runtime/sys_freebsd_arm64.s +++ b/src/runtime/sys_freebsd_arm64.s @@ -460,7 +460,7 @@ TEXT runtime·getCntxct(SB),NOSPLIT,$0 BEQ 3(PC) // get CNTPCT (Physical Count Register) into R0 - MRS CNTPCT_EL0, R0 // SIGILL + MRS CNTPCT_EL0, R0 B 2(PC) // get CNTVCT (Virtual Count Register) into R0 diff --git a/src/runtime/vdso_freebsd_arm64.go b/src/runtime/vdso_freebsd_arm64.go index 7d9f62d5f928ca..37b26d73e78801 100644 --- a/src/runtime/vdso_freebsd_arm64.go +++ b/src/runtime/vdso_freebsd_arm64.go @@ -14,7 +14,7 @@ func getCntxct(physical bool) uint32 func (th *vdsoTimehands) getTimecounter() (uint32, bool) { switch th.algo { case _VDSO_TH_ALGO_ARM_GENTIM: - return getCntxct(false), true + return getCntxct(th.physical != 0), true default: return 0, false }