Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/include PR/56002: aarch64 has a true 64bit ...



details:   https://anonhg.NetBSD.org/src/rev/f5bf0dfdca55
branches:  trunk
changeset: 980922:f5bf0dfdca55
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Feb 22 09:29:38 2021 +0000

description:
PR/56002: aarch64 has a true 64bit CPU cycle counter, we will use it.

This fix solves PR/56002 on aarch64, but this problems can occur on
all other architectures where cpu_counter() is 32bit.

diffstat:

 sys/arch/aarch64/include/cpu_counter.h |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 6ad34b8e222d -r f5bf0dfdca55 sys/arch/aarch64/include/cpu_counter.h
--- a/sys/arch/aarch64/include/cpu_counter.h    Mon Feb 22 06:21:35 2021 +0000
+++ b/sys/arch/aarch64/include/cpu_counter.h    Mon Feb 22 09:29:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_counter.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */
+/* $NetBSD: cpu_counter.h,v 1.2 2021/02/22 09:29:38 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -44,7 +44,12 @@
 #include <aarch64/armreg.h>
 
 #define cpu_hascounter()       (curcpu()->ci_data.cpu_cc_freq != 0)
-#define cpu_counter()          cpu_counter32()
+
+static __inline uint64_t
+cpu_counter(void)
+{
+       return reg_pmccntr_el0_read();
+}
 
 static __inline uint32_t
 cpu_counter32(void)



Home | Main Index | Thread Index | Old Index