From 6619a8fb594486363783cc4a8372e4d4ee4b913e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 17 Oct 2007 18:04:37 +0200 Subject: x86: Create clflush() inline, remove hardcoded wbinvd Create an inline function for clflush(), with the proper arguments, and use it instead of hard-coding the instruction. This also removes one instance of hard-coded wbinvd, based on a patch by Bauder de Oliveira Costa. [ tglx: arch/x86 adaptation ] Cc: Andi Kleen Cc: Glauber de Oliveira Costa Signed-off-by: H. Peter Anvin Signed-off-by: Andi Kleen Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- include/asm-x86/system_32.h | 4 ++++ include/asm-x86/system_64.h | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h index 1d6fb3afa53..db6283eb5e4 100644 --- a/include/asm-x86/system_32.h +++ b/include/asm-x86/system_32.h @@ -161,6 +161,10 @@ static inline void native_wbinvd(void) asm volatile("wbinvd": : :"memory"); } +static inline void clflush(volatile void *__p) +{ + asm volatile("clflush %0" : "+m" (*(char __force *)__p)); +} #ifdef CONFIG_PARAVIRT #include diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h index fb4bcf99e66..ec4c29bcfcb 100644 --- a/include/asm-x86/system_64.h +++ b/include/asm-x86/system_64.h @@ -137,6 +137,11 @@ static inline void write_cr8(unsigned long val) #endif /* __KERNEL__ */ +static inline void clflush(volatile void *__p) +{ + asm volatile("clflush %0" : "+m" (*(char __force *)__p)); +} + #define nop() __asm__ __volatile__ ("nop") #ifdef CONFIG_SMP -- cgit v1.2.3