• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ARCH_X86_H
2 #define ARCH_X86_H
3 
do_cpuid(unsigned int * eax,unsigned int * ebx,unsigned int * ecx,unsigned int * edx)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_x86)
16 
17 #define	FIO_HUGE_PAGE		4194304
18 
19 #define nop		__asm__ __volatile__("rep;nop": : :"memory")
20 #define read_barrier()	__asm__ __volatile__("": : :"memory")
21 #define write_barrier()	__asm__ __volatile__("": : :"memory")
22 
arch_ffz(unsigned long bitmask)23 static inline unsigned long arch_ffz(unsigned long bitmask)
24 {
25 	__asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
26 	return bitmask;
27 }
28 
get_cpu_clock(void)29 static inline unsigned long long get_cpu_clock(void)
30 {
31 	unsigned long long ret;
32 
33 	__asm__ __volatile__("rdtsc" : "=A" (ret));
34 	return ret;
35 }
36 
37 #define ARCH_HAVE_FFZ
38 #define ARCH_HAVE_CPU_CLOCK
39 
40 #endif
41