X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=arch%2Farch-x86_64.h;h=8bdf01e84dd2a3558c3f2eee6a98f2d17176750c;hp=a8f075a00a5656079f0a5107accad2eff34c0cd0;hb=2d3b79c7747eb077b85152d0bb82304b3eff40a6;hpb=6164890e4db96c073274990edca12706e9c41659 diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h index a8f075a0..8bdf01e8 100644 --- a/arch/arch-x86_64.h +++ b/arch/arch-x86_64.h @@ -1,7 +1,18 @@ #ifndef ARCH_X86_64_h #define ARCH_X86_64_h -#define ARCH (arch_x86_64) +static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + asm volatile("cpuid" + : "=a" (*eax), "=b" (*ebx), "=r" (*ecx), "=d" (*edx) + : "0" (*eax), "2" (*ecx) + : "memory"); +} + +#include "arch-x86-common.h" + +#define FIO_ARCH (arch_x86_64) #ifndef __NR_ioprio_set #define __NR_ioprio_set 251 @@ -18,25 +29,28 @@ #define __NR_sys_vmsplice 278 #endif -#ifndef __NR_async_exec -#define __NR_async_exec 286 -#define __NR_async_wait 287 -#define __NR_umem_add 288 -#define __NR_async_thread 289 -#endif - #define FIO_HUGE_PAGE 2097152 -#define FIO_HAVE_SYSLET - #define nop __asm__ __volatile__("rep;nop": : :"memory") -#define read_barrier() asm volatile("lfence":::"memory") +#define read_barrier() __asm__ __volatile__("lfence":::"memory") +#define write_barrier() __asm__ __volatile__("sfence":::"memory") -static inline unsigned int arch_ffz(unsigned int bitmask) +static inline unsigned long arch_ffz(unsigned long bitmask) { - __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask)); + __asm__("bsf %1,%0" :"=r" (bitmask) :"r" (~bitmask)); return bitmask; } -//#define ARCH_HAVE_FFZ + +static inline unsigned long long get_cpu_clock(void) +{ + unsigned int lo, hi; + + __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi)); + return ((unsigned long long) hi << 32ULL) | lo; +} + +#define ARCH_HAVE_FFZ +#define ARCH_HAVE_SSE4_2 +#define ARCH_HAVE_CPU_CLOCK #endif