Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jun 2021 05:27:28 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e6caac717b4f - main - libsa: Add tslog support for arm64
Message-ID:  <202106240527.15O5RS2m000856@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6caac717b4fc2b87cf93f67109884e768253e77

commit e6caac717b4fc2b87cf93f67109884e768253e77
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-06-24 05:21:23 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2021-06-24 05:21:23 +0000

    libsa: Add tslog support for arm64
    
    The original code only supported x86 and used rdtsc(); we now also
    support arm64 and use the CNTVCT_EL0 special register.
---
 stand/libsa/tslog.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/stand/libsa/tslog.c b/stand/libsa/tslog.c
index 7ea18e0bb8f8..c6164aab02a9 100644
--- a/stand/libsa/tslog.c
+++ b/stand/libsa/tslog.c
@@ -29,7 +29,11 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 
+#if defined(__amd64__) || defined(__i386__)
 #include <machine/cpufunc.h>
+#elif defined(__aarch64__)
+#include <machine/armreg.h>
+#endif
 
 #include <stand.h>
 
@@ -60,6 +64,8 @@ tslog(const char * type, const char * f, const char * s)
 {
 #if defined(__amd64__) || defined(__i386__)
 	uint64_t tsc = rdtsc();
+#elif defined(__aarch64__)
+	uint64_t tsc = READ_SPECIALREG(cntvct_el0);
 #else
 	uint64_t tsc = 0;
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106240527.15O5RS2m000856>