Add check for invariant TSC on x86 and use TSC is default clock if reliable
[fio.git] / arch / arch-x86.h
1 #ifndef ARCH_X86_H
2 #define ARCH_X86_H
3
4 #include "arch-x86-common.h"
5
6 #define FIO_ARCH        (arch_i386)
7
8 #ifndef __NR_ioprio_set
9 #define __NR_ioprio_set         289
10 #define __NR_ioprio_get         290
11 #endif
12
13 #ifndef __NR_fadvise64
14 #define __NR_fadvise64          250
15 #endif
16
17 #ifndef __NR_sys_splice
18 #define __NR_sys_splice         313
19 #define __NR_sys_tee            315
20 #define __NR_sys_vmsplice       316
21 #endif
22
23 #ifndef __NR_async_exec
24 #define __NR_async_exec         325
25 #define __NR_async_wait         326
26 #define __NR_umem_add           327
27 #define __NR_async_thread       328
28 #endif
29
30 #define FIO_HUGE_PAGE           4194304
31
32 #define FIO_HAVE_SYSLET
33
34 #define nop             __asm__ __volatile__("rep;nop": : :"memory")
35 #define read_barrier()  __asm__ __volatile__("": : :"memory")
36 #define write_barrier() __asm__ __volatile__("": : :"memory")
37
38 static inline unsigned long arch_ffz(unsigned long bitmask)
39 {
40         __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
41         return bitmask;
42 }
43
44 static inline unsigned long long get_cpu_clock(void)
45 {
46         unsigned long ret;
47
48         __asm__ __volatile__("rdtsc" : "=A" (ret));
49         return ret;
50 }
51
52 #define ARCH_HAVE_FFZ
53 #define ARCH_HAVE_CPU_CLOCK
54
55 #endif