9 #define FIO_ARCH (arch_riscv64)
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")
15 static inline unsigned long long get_cpu_clock(void)
19 asm volatile("rdtime %0" : "=r"(val));
22 #define ARCH_HAVE_CPU_CLOCK
24 #define ARCH_HAVE_INIT
25 extern bool tsc_reliable;
26 static inline int arch_init(char *envp[])
32 #define __do_syscallM(...) ({ \
41 #define __do_syscallN(...) ({ \
50 #define __do_syscall0(__n) ({ \
51 register long a7 __asm__("a7") = __n; \
52 register long a0 __asm__("a0"); \
54 __do_syscallM("r" (a7)); \
57 #define __do_syscall1(__n, __a) ({ \
58 register long a7 __asm__("a7") = __n; \
59 register __typeof__(__a) a0 __asm__("a0") = __a; \
61 __do_syscallM("r" (a7), "0" (a0)); \
64 #define __do_syscall2(__n, __a, __b) ({ \
65 register long a7 __asm__("a7") = __n; \
66 register __typeof__(__a) a0 __asm__("a0") = __a; \
67 register __typeof__(__b) a1 __asm__("a1") = __b; \
69 __do_syscallN("r" (a7), "0" (a0), "r" (a1)); \
72 #define __do_syscall3(__n, __a, __b, __c) ({ \
73 register long a7 __asm__("a7") = __n; \
74 register __typeof__(__a) a0 __asm__("a0") = __a; \
75 register __typeof__(__b) a1 __asm__("a1") = __b; \
76 register __typeof__(__c) a2 __asm__("a2") = __c; \
78 __do_syscallN("r" (a7), "0" (a0), "r" (a1), "r" (a2)); \
81 #define __do_syscall4(__n, __a, __b, __c, __d) ({ \
82 register long a7 __asm__("a7") = __n; \
83 register __typeof__(__a) a0 __asm__("a0") = __a; \
84 register __typeof__(__b) a1 __asm__("a1") = __b; \
85 register __typeof__(__c) a2 __asm__("a2") = __c; \
86 register __typeof__(__d) a3 __asm__("a3") = __d; \
88 __do_syscallN("r" (a7), "0" (a0), "r" (a1), "r" (a2), "r" (a3));\
91 #define __do_syscall5(__n, __a, __b, __c, __d, __e) ({ \
92 register long a7 __asm__("a7") = __n; \
93 register __typeof__(__a) a0 __asm__("a0") = __a; \
94 register __typeof__(__b) a1 __asm__("a1") = __b; \
95 register __typeof__(__c) a2 __asm__("a2") = __c; \
96 register __typeof__(__d) a3 __asm__("a3") = __d; \
97 register __typeof__(__e) a4 __asm__("a4") = __e; \
99 __do_syscallN("r" (a7), "0" (a0), "r" (a1), "r" (a2), "r" (a3), \
103 #define __do_syscall6(__n, __a, __b, __c, __d, __e, __f) ({ \
104 register long a7 __asm__("a7") = __n; \
105 register __typeof__(__a) a0 __asm__("a0") = __a; \
106 register __typeof__(__b) a1 __asm__("a1") = __b; \
107 register __typeof__(__c) a2 __asm__("a2") = __c; \
108 register __typeof__(__d) a3 __asm__("a3") = __d; \
109 register __typeof__(__e) a4 __asm__("a4") = __e; \
110 register __typeof__(__f) a5 __asm__("a5") = __f; \
112 __do_syscallN("r" (a7), "0" (a0), "r" (a1), "r" (a2), "r" (a3), \
113 "r" (a4), "r"(a5)); \
116 #define FIO_ARCH_HAS_SYSCALL