Commit | Line | Data |
---|---|---|
78c8831e DK |
1 | #ifndef ARCH_AARCH64_H |
2 | #define ARCH_AARCH64_H | |
3 | ||
4 | #include <unistd.h> | |
5 | #include <stdlib.h> | |
6 | #include <sys/types.h> | |
7 | #include <sys/wait.h> | |
8 | ||
9 | #define FIO_ARCH (arch_aarch64) | |
10 | ||
78c8831e DK |
11 | #define nop do { __asm__ __volatile__ ("yield"); } while (0) |
12 | #define read_barrier() do { __sync_synchronize(); } while (0) | |
13 | #define write_barrier() do { __sync_synchronize(); } while (0) | |
14 | ||
15 | static inline int arch_ffz(unsigned long bitmask) | |
16 | { | |
17 | unsigned long count, reversed_bits; | |
18 | if (~bitmask == 0) /* ffz() in lib/ffz.h does this. */ | |
19 | return 63; | |
20 | ||
21 | __asm__ __volatile__ ("rbit %1, %2\n" | |
22 | "clz %0, %1\n" : | |
23 | "=r"(count), "=&r"(reversed_bits) : | |
24 | "r"(~bitmask)); | |
25 | return count; | |
26 | } | |
27 | ||
28 | #define ARCH_HAVE_FFZ | |
29 | ||
f57a3a31 JA |
30 | static inline unsigned long long get_cpu_clock(void) |
31 | { | |
32 | unsigned long val; | |
33 | ||
34 | asm volatile("mrs %0, cntvct_el0" : "=r" (val)); | |
35 | return val; | |
36 | } | |
37 | #define ARCH_HAVE_CPU_CLOCK | |
38 | ||
39 | #define ARCH_HAVE_INIT | |
40 | extern bool tsc_reliable; | |
41 | static inline int arch_init(char *envp[]) | |
42 | { | |
43 | tsc_reliable = true; | |
44 | return 0; | |
45 | } | |
46 | ||
78c8831e | 47 | #endif |