1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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
This commit is contained in:
Mark Johnston 2018-11-13 18:20:27 +00:00
parent 1e2ceeb16a
commit 6f8ba91638
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340400

View File

@ -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