Hoernchen has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/gapk/+/33620 )


Change subject: aarch64: add get_cycles
......................................................................

aarch64: add get_cycles

borrowed from arch/arm64/include/asm/arch_timer.h

Change-Id: I489fb8346fbc7440f40695f01d80a89b90761165
---
M include/osmocom/gapk/get_cycles.h
1 file changed, 21 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/20/33620/1

diff --git a/include/osmocom/gapk/get_cycles.h 
b/include/osmocom/gapk/get_cycles.h
index 40ac570..c225e4b 100644
--- a/include/osmocom/gapk/get_cycles.h
+++ b/include/osmocom/gapk/get_cycles.h
@@ -103,6 +103,16 @@
 #endif
        return ret & ~TICK_PRIV_BIT;
 }
+#elif defined(__aarch64__)
+
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+       cycles_t cval;
+       asm volatile("isb" : : : "memory");
+       asm volatile("mrs %0, cntvct_el0" : "=r" (cval));
+       return cval;
+}
 #elif defined(__PPC__)
 #define CPU_FTR_601                  0x00000100
 typedef unsigned long cycles_t;

--
To view, visit https://gerrit.osmocom.org/c/gapk/+/33620
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Change-Id: I489fb8346fbc7440f40695f01d80a89b90761165
Gerrit-Change-Number: 33620
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <[email protected]>
Gerrit-MessageType: newchange

Reply via email to