提交 0ccb8acc 编写于 作者: G Glauber de Oliveira Costa 提交者: Ingo Molnar

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: NGlauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 683e0253
...@@ -10,6 +10,17 @@ struct mm_struct; ...@@ -10,6 +10,17 @@ struct mm_struct;
#include <asm/page.h> #include <asm/page.h>
#include <asm/system.h> #include <asm/system.h>
/*
* 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, static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx) unsigned int *ecx, unsigned int *edx)
{ {
......
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/desc_defs.h> #include <asm/desc_defs.h>
/*
* 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. * CPU type and hardware bug flags. Kept separately for each CPU.
* Members of this structure are referenced in head.S, so think twice * Members of this structure are referenced in head.S, so think twice
......
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <asm/desc_defs.h> #include <asm/desc_defs.h>
/*
* 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. * CPU type and hardware bug flags. Kept separately for each CPU.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册