Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2015 12:50:46 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285745 - head/sys/arm64/include
Message-ID:  <201507211250.t6LCokFf051783@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Tue Jul 21 12:50:45 2015
New Revision: 285745
URL: https://svnweb.freebsd.org/changeset/base/285745

Log:
  Implement get_cyclecount() on ARM64
  
  Use Vritual Counter register associated with Generic Timer to
  read the cyclecount.
  
  Obtained from: Semihalf
  Sponsored by:  The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D3134

Modified:
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/include/cpu.h
==============================================================================
--- head/sys/arm64/include/cpu.h	Tue Jul 21 12:47:15 2015	(r285744)
+++ head/sys/arm64/include/cpu.h	Tue Jul 21 12:50:45 2015	(r285745)
@@ -43,6 +43,7 @@
 
 #include <machine/atomic.h>
 #include <machine/frame.h>
+#include <machine/armreg.h>
 
 #define	TRAPF_PC(tfp)		((tfp)->tf_lr)
 #define	TRAPF_USERMODE(tfp)	(((tfp)->tf_elr & (1ul << 63)) == 0)
@@ -120,9 +121,11 @@ void	swi_vm(void *v);
 static __inline uint64_t
 get_cyclecount(void)
 {
+	uint64_t ret;
 
-	/* TODO: This is bogus */
-	return (1);
+	ret = READ_SPECIALREG(cntvct_el0);
+
+	return (ret);
 }
 
 #define	ADDRESS_TRANSLATE_FUNC(stage)				\



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