Skip to content

Commit

Permalink
x86: unify current_text_addr
Browse files Browse the repository at this point in the history
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 <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Glauber de Oliveira Costa authored and Ingo Molnar committed Jan 30, 2008
1 parent 683e025 commit 0ccb8ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
11 changes: 11 additions & 0 deletions include/asm-x86/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ struct mm_struct;
#include <asm/page.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,
unsigned int *ecx, unsigned int *edx)
{
Expand Down
6 changes: 0 additions & 6 deletions include/asm-x86/processor_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
#include <linux/init.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.
* Members of this structure are referenced in head.S, so think twice
Expand Down
6 changes: 0 additions & 6 deletions include/asm-x86/processor_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
#include <linux/cpumask.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.
*/
Expand Down

0 comments on commit 0ccb8ac

Please sign in to comment.