Author: markj
Date: Tue Nov 13 18:20:27 2018
New Revision: 340400
URL: https://svnweb.freebsd.org/changeset/base/340400

Log:
  RISC-V: Implement get_cyclecount(9).
  
  Add the missing implementation for get_cyclecount(9) on RISC-V by
  reading the cycle CSR.
  
  Submitted by: Mitchell Horne <mhorne...@gmail.com>
  Reviewed by:  jhb
  MFC after:    2 weeks
  Differential Revision:        https://reviews.freebsd.org/D17953

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

Modified: head/sys/riscv/include/cpu.h
==============================================================================
--- head/sys/riscv/include/cpu.h        Tue Nov 13 18:12:06 2018        
(r340399)
+++ head/sys/riscv/include/cpu.h        Tue Nov 13 18:20:27 2018        
(r340400)
@@ -38,6 +38,7 @@
 #define        _MACHINE_CPU_H_
 
 #include <machine/atomic.h>
+#include <machine/cpufunc.h>
 #include <machine/frame.h>
 
 #define        TRAPF_PC(tfp)           ((tfp)->tf_ra)
@@ -86,8 +87,7 @@ static __inline uint64_t
 get_cyclecount(void)
 {
 
-       /* TODO: This is bogus */
-       return (1);
+       return (rdcycle());
 }
 
 #endif
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to