| 1 | #ifndef ARCH_X86_H |
| 2 | #define ARCH_X86_H |
| 3 | |
| 4 | static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, |
| 5 | unsigned int *ecx, unsigned int *edx) |
| 6 | { |
| 7 | asm volatile("xchgl %%ebx, %1\ncpuid\nxchgl %%ebx, %1" |
| 8 | : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx) |
| 9 | : "0" (*eax) |
| 10 | : "memory"); |
| 11 | } |
| 12 | |
| 13 | #include "arch-x86-common.h" |
| 14 | |
| 15 | #define FIO_ARCH (arch_i386) |
| 16 | |
| 17 | #ifndef __NR_ioprio_set |
| 18 | #define __NR_ioprio_set 289 |
| 19 | #define __NR_ioprio_get 290 |
| 20 | #endif |
| 21 | |
| 22 | #ifndef __NR_fadvise64 |
| 23 | #define __NR_fadvise64 250 |
| 24 | #endif |
| 25 | |
| 26 | #ifndef __NR_sys_splice |
| 27 | #define __NR_sys_splice 313 |
| 28 | #define __NR_sys_tee 315 |
| 29 | #define __NR_sys_vmsplice 316 |
| 30 | #endif |
| 31 | |
| 32 | #define FIO_HUGE_PAGE 4194304 |
| 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 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 |