Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | #ifndef ARCH_X86_H |
| 2 | #define ARCH_X86_H |
| 3 | |
Jens Axboe | 6b13c71 | 2013-04-12 09:15:42 +0200 | [diff] [blame] | 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 | |
Jens Axboe | fa80fea | 2012-12-09 20:29:00 +0100 | [diff] [blame] | 13 | #include "arch-x86-common.h" |
| 14 | |
Jens Axboe | cca8464 | 2011-10-07 12:47:57 +0200 | [diff] [blame] | 15 | #define FIO_ARCH (arch_i386) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 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 | |
Jens Axboe | 8756e4d | 2006-05-27 20:24:53 +0200 | [diff] [blame] | 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 | |
Jens Axboe | cb25df6 | 2007-03-23 08:23:30 +0100 | [diff] [blame] | 32 | #define FIO_HUGE_PAGE 4194304 |
| 33 | |
Jens Axboe | db6defc | 2007-12-11 08:55:53 +0100 | [diff] [blame] | 34 | #define nop __asm__ __volatile__("rep;nop": : :"memory") |
Jens Axboe | 44c47fe | 2008-06-04 14:31:25 +0200 | [diff] [blame] | 35 | #define read_barrier() __asm__ __volatile__("": : :"memory") |
| 36 | #define write_barrier() __asm__ __volatile__("": : :"memory") |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 37 | |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 38 | static inline unsigned long arch_ffz(unsigned long bitmask) |
| 39 | { |
| 40 | __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask)); |
| 41 | return bitmask; |
| 42 | } |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 43 | |
| 44 | static inline unsigned long long get_cpu_clock(void) |
| 45 | { |
Jens Axboe | 6eb9d1b | 2013-02-21 12:39:42 +0100 | [diff] [blame] | 46 | unsigned long long ret; |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 47 | |
| 48 | __asm__ __volatile__("rdtsc" : "=A" (ret)); |
| 49 | return ret; |
| 50 | } |
| 51 | |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 52 | #define ARCH_HAVE_FFZ |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 53 | #define ARCH_HAVE_CPU_CLOCK |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 54 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 55 | #endif |