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)                           \
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to