diff options
author | Zbigniew Bodek <zbb@FreeBSD.org> | 2015-07-21 12:50:45 +0000 |
---|---|---|
committer | Zbigniew Bodek <zbb@FreeBSD.org> | 2015-07-21 12:50:45 +0000 |
commit | 52b584bc157331a6a8b12a727172c5c6f49c8bfc (patch) | |
tree | 7e0bc00b14ca43beff872359ea1ab4009a194b36 /sys/arm64/include/cpu.h | |
parent | 21d30b29d521bce25e8a9474d4852c4da36bcf37 (diff) | |
download | src-52b584bc157331a6a8b12a727172c5c6f49c8bfc.tar.gz src-52b584bc157331a6a8b12a727172c5c6f49c8bfc.zip |
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
Notes
Notes:
svn path=/head/; revision=285745
Diffstat (limited to 'sys/arm64/include/cpu.h')
-rw-r--r-- | sys/arm64/include/cpu.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index 33e2af65da4f..15cdd80d4e26 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -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) \ |