a74b7d475808256cb25c9472c85c1bc714eb98e0
[fio.git] / arch / arch-riscv64.h
1 #ifndef ARCH_RISCV64_H
2 #define ARCH_RISCV64_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_riscv64)
10
11 #define nop             __asm__ __volatile__ ("nop")
12 #define read_barrier()          __asm__ __volatile__("fence r, r": : :"memory")
13 #define write_barrier()         __asm__ __volatile__("fence w, w": : :"memory")
14
15 static inline unsigned long long get_cpu_clock(void)
16 {
17         unsigned long val;
18
19         asm volatile("rdcycle %0" : "=r"(val));
20         return val;
21 }
22 #define ARCH_HAVE_CPU_CLOCK
23
24 #define ARCH_HAVE_INIT
25 extern bool tsc_reliable;
26 static inline int arch_init(char *envp[])
27 {
28         tsc_reliable = true;
29         return 0;
30 }
31
32 #endif