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
This commit is contained in:
Zbigniew Bodek 2015-07-21 12:50:45 +00:00
parent 21d30b29d5
commit 52b584bc15
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285745

View File

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