From: Glauber de Oliveira Costa Date: Wed, 30 Jan 2008 12:31:27 +0000 (+0100) Subject: x86: unify current_text_addr X-Git-Tag: v2.6.25-rc1~1143^2~541 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ccb8acc51693a2aef0f38024943808046d81251;p=linux-2.6 x86: unify current_text_addr current_text_addr() has a different implementation in x86_64 and i386, but it is not fundamentally different. I stick to the i386 implementation, that seem to be a common base, and move it to processor.h Signed-off-by: Glauber de Oliveira Costa Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index 52e3637ef5..3deb5ba55f 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h @@ -10,6 +10,17 @@ struct mm_struct; #include #include +/* + * Default implementation of macro that returns current + * instruction pointer ("program counter"). + */ +static inline void *current_text_addr(void) +{ + void *pc; + asm volatile("mov $1f,%0\n1:":"=r" (pc)); + return pc; +} + static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 9e119d3789..6cd2149dcb 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h @@ -21,12 +21,6 @@ #include #include -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) - /* * CPU type and hardware bug flags. Kept separately for each CPU. * Members of this structure are referenced in head.S, so think twice diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h index 5f5c7fc637..1984a4a38b 100644 --- a/include/asm-x86/processor_64.h +++ b/include/asm-x86/processor_64.h @@ -20,12 +20,6 @@ #include #include -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ void *pc; asm volatile("leaq 1f(%%rip),%0\n1:":"=r"(pc)); pc; }) - /* * CPU type and hardware bug flags. Kept separately for each CPU. */