blob: 385a9124ec5ee9ef416201ba6d730b6d3aafd7e1 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001#ifndef ARCH_X86_H
2#define ARCH_X86_H
3
Jens Axboe6b13c712013-04-12 09:15:42 +02004static 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 Axboefa80fea2012-12-09 20:29:00 +010013#include "arch-x86-common.h"
14
Jens Axboecca84642011-10-07 12:47:57 +020015#define FIO_ARCH (arch_i386)
Jens Axboeebac4652005-12-08 15:25:21 +010016
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 Axboe8756e4d2006-05-27 20:24:53 +020026#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 Axboecb25df62007-03-23 08:23:30 +010032#define FIO_HUGE_PAGE 4194304
33
Jens Axboedb6defc2007-12-11 08:55:53 +010034#define nop __asm__ __volatile__("rep;nop": : :"memory")
Jens Axboe44c47fe2008-06-04 14:31:25 +020035#define read_barrier() __asm__ __volatile__("": : :"memory")
36#define write_barrier() __asm__ __volatile__("": : :"memory")
Jens Axboeebac4652005-12-08 15:25:21 +010037
Jens Axboe8f7e39d2008-06-01 19:45:10 +020038static inline unsigned long arch_ffz(unsigned long bitmask)
39{
40 __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
41 return bitmask;
42}
Jens Axboec223da82010-03-24 13:23:53 +010043
44static inline unsigned long long get_cpu_clock(void)
45{
Jens Axboe6eb9d1b2013-02-21 12:39:42 +010046 unsigned long long ret;
Jens Axboec223da82010-03-24 13:23:53 +010047
48 __asm__ __volatile__("rdtsc" : "=A" (ret));
49 return ret;
50}
51
Jens Axboe8f7e39d2008-06-01 19:45:10 +020052#define ARCH_HAVE_FFZ
Jens Axboec223da82010-03-24 13:23:53 +010053#define ARCH_HAVE_CPU_CLOCK
Jens Axboe8f7e39d2008-06-01 19:45:10 +020054
Jens Axboeebac4652005-12-08 15:25:21 +010055#endif