Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | #ifndef ARCH_X86_64_h |
| 2 | #define ARCH_X86_64_h |
| 3 | |
Jens Axboe | cca8464 | 2011-10-07 12:47:57 +0200 | [diff] [blame] | 4 | #define FIO_ARCH (arch_x86_64) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 5 | |
| 6 | #ifndef __NR_ioprio_set |
| 7 | #define __NR_ioprio_set 251 |
| 8 | #define __NR_ioprio_get 252 |
| 9 | #endif |
| 10 | |
| 11 | #ifndef __NR_fadvise64 |
| 12 | #define __NR_fadvise64 221 |
| 13 | #endif |
| 14 | |
Jens Axboe | 8756e4d | 2006-05-27 20:24:53 +0200 | [diff] [blame] | 15 | #ifndef __NR_sys_splice |
| 16 | #define __NR_sys_splice 275 |
| 17 | #define __NR_sys_tee 276 |
| 18 | #define __NR_sys_vmsplice 278 |
| 19 | #endif |
| 20 | |
Jens Axboe | 1ff2a7e | 2007-02-28 08:57:27 +0100 | [diff] [blame] | 21 | #ifndef __NR_async_exec |
Zach Brown | 36ddbc0 | 2007-09-19 08:42:16 +0200 | [diff] [blame] | 22 | #define __NR_async_exec 286 |
| 23 | #define __NR_async_wait 287 |
| 24 | #define __NR_umem_add 288 |
| 25 | #define __NR_async_thread 289 |
Jens Axboe | 1ff2a7e | 2007-02-28 08:57:27 +0100 | [diff] [blame] | 26 | #endif |
| 27 | |
Jens Axboe | cb25df6 | 2007-03-23 08:23:30 +0100 | [diff] [blame] | 28 | #define FIO_HUGE_PAGE 2097152 |
| 29 | |
Jens Axboe | 1ff2a7e | 2007-02-28 08:57:27 +0100 | [diff] [blame] | 30 | #define FIO_HAVE_SYSLET |
| 31 | |
Jens Axboe | db6defc | 2007-12-11 08:55:53 +0100 | [diff] [blame] | 32 | #define nop __asm__ __volatile__("rep;nop": : :"memory") |
Jens Axboe | 44c47fe | 2008-06-04 14:31:25 +0200 | [diff] [blame] | 33 | #define read_barrier() __asm__ __volatile__("lfence":::"memory") |
| 34 | #define write_barrier() __asm__ __volatile__("sfence":::"memory") |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 35 | |
Jens Axboe | 0ce8b11 | 2011-01-27 22:25:29 +0100 | [diff] [blame] | 36 | static inline unsigned long arch_ffz(unsigned long bitmask) |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 37 | { |
Jens Axboe | 0ce8b11 | 2011-01-27 22:25:29 +0100 | [diff] [blame] | 38 | __asm__("bsf %1,%0" :"=r" (bitmask) :"r" (~bitmask)); |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 39 | return bitmask; |
| 40 | } |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 41 | |
| 42 | static inline unsigned long long get_cpu_clock(void) |
| 43 | { |
| 44 | unsigned int lo, hi; |
| 45 | |
| 46 | __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi)); |
| 47 | return ((unsigned long long) hi << 32ULL) | lo; |
| 48 | } |
| 49 | |
Jens Axboe | 21df44a | 2008-06-02 09:43:29 +0200 | [diff] [blame] | 50 | #define ARCH_HAVE_FFZ |
Jens Axboe | 2f68124 | 2010-10-21 08:15:59 +0200 | [diff] [blame] | 51 | #define ARCH_HAVE_SSE4_2 |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 52 | #define ARCH_HAVE_CPU_CLOCK |
Jens Axboe | 8f7e39d | 2008-06-01 19:45:10 +0200 | [diff] [blame] | 53 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 54 | #endif |