blob: 29e681f2f8533926451e731460b69a499fc0aa53 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001#ifndef ARCH_X86_64_h
2#define ARCH_X86_64_h
3
Jens Axboecca84642011-10-07 12:47:57 +02004#define FIO_ARCH (arch_x86_64)
Jens Axboeebac4652005-12-08 15:25:21 +01005
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 Axboe8756e4d2006-05-27 20:24:53 +020015#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 Axboe1ff2a7e2007-02-28 08:57:27 +010021#ifndef __NR_async_exec
Zach Brown36ddbc02007-09-19 08:42:16 +020022#define __NR_async_exec 286
23#define __NR_async_wait 287
24#define __NR_umem_add 288
25#define __NR_async_thread 289
Jens Axboe1ff2a7e2007-02-28 08:57:27 +010026#endif
27
Jens Axboecb25df62007-03-23 08:23:30 +010028#define FIO_HUGE_PAGE 2097152
29
Jens Axboe1ff2a7e2007-02-28 08:57:27 +010030#define FIO_HAVE_SYSLET
31
Jens Axboedb6defc2007-12-11 08:55:53 +010032#define nop __asm__ __volatile__("rep;nop": : :"memory")
Jens Axboe44c47fe2008-06-04 14:31:25 +020033#define read_barrier() __asm__ __volatile__("lfence":::"memory")
34#define write_barrier() __asm__ __volatile__("sfence":::"memory")
Jens Axboeebac4652005-12-08 15:25:21 +010035
Jens Axboe0ce8b112011-01-27 22:25:29 +010036static inline unsigned long arch_ffz(unsigned long bitmask)
Jens Axboe8f7e39d2008-06-01 19:45:10 +020037{
Jens Axboe0ce8b112011-01-27 22:25:29 +010038 __asm__("bsf %1,%0" :"=r" (bitmask) :"r" (~bitmask));
Jens Axboe8f7e39d2008-06-01 19:45:10 +020039 return bitmask;
40}
Jens Axboec223da82010-03-24 13:23:53 +010041
42static 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 Axboe21df44a2008-06-02 09:43:29 +020050#define ARCH_HAVE_FFZ
Jens Axboe2f681242010-10-21 08:15:59 +020051#define ARCH_HAVE_SSE4_2
Jens Axboec223da82010-03-24 13:23:53 +010052#define ARCH_HAVE_CPU_CLOCK
Jens Axboe8f7e39d2008-06-01 19:45:10 +020053
Jens Axboeebac4652005-12-08 15:25:21 +010054#endif