Module Name: src Committed By: ryo Date: Mon Feb 22 09:29:38 UTC 2021
Modified Files: src/sys/arch/aarch64/include: cpu_counter.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/include/cpu_counter.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/aarch64/include/cpu_counter.h diff -u src/sys/arch/aarch64/include/cpu_counter.h:1.1 src/sys/arch/aarch64/include/cpu_counter.h:1.2 --- src/sys/arch/aarch64/include/cpu_counter.h:1.1 Sun Aug 10 05:47:38 2014 +++ src/sys/arch/aarch64/include/cpu_counter.h Mon Feb 22 09:29:38 2021 @@ -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)