svn commit: r340400 - head/sys/riscv/include

Mark Johnston markj at FreeBSD.org
Tue Nov 13 18:20:28 UTC 2018


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 <mhorne063 at 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


More information about the svn-src-head mailing list