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 
11 #ifndef __NR_ioprio_set
12 #define __NR_ioprio_set		30
13 #define __NR_ioprio_get		31
14 #endif
15 
16 #define nop		do { __asm__ __volatile__ ("yield"); } while (0)
17 #define read_barrier()	do { __sync_synchronize(); } while (0)
18 #define write_barrier()	do { __sync_synchronize(); } while (0)
19 
arch_ffz(unsigned long bitmask)20 static inline int arch_ffz(unsigned long bitmask)
21 {
22 	unsigned long count, reversed_bits;
23 	if (~bitmask == 0)	/* ffz() in lib/ffz.h does this. */
24 		return 63;
25 
26 	__asm__ __volatile__ ("rbit %1, %2\n"
27 			      "clz %0, %1\n" :
28 			      "=r"(count), "=&r"(reversed_bits) :
29 			      "r"(~bitmask));
30 	return count;
31 }
32 
33 #define ARCH_HAVE_FFZ
34 
35 #endif
36