Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2018 18:20:27 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340400 - head/sys/riscv/include
Message-ID:  <201811131820.wADIKRCs019563@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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



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