Skip to content

Commit

Permalink
x86: move load_cr3 to a common place.
Browse files Browse the repository at this point in the history
There are currently two definitions of load_cr3, that essentially do the
same thing. This patch moves them all 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 746ff60 commit c72dcf8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 0 additions & 5 deletions include/asm-x86/mmu_context_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
#endif
}

static inline void load_cr3(pgd_t *pgd)
{
asm volatile("movq %0,%%cr3" :: "r" (__pa(pgd)) : "memory");
}

static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
struct task_struct *tsk)
{
Expand Down
7 changes: 7 additions & 0 deletions include/asm-x86/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include <asm/processor-flags.h>

#include <asm/page.h>
#include <asm/system.h>

static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
Expand All @@ -15,6 +18,10 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
: "0" (*eax), "2" (*ecx));
}

static inline void load_cr3(pgd_t *pgdir)
{
write_cr3(__pa(pgdir));
}

#ifdef CONFIG_X86_32
# include "processor_32.h"
Expand Down
1 change: 0 additions & 1 deletion include/asm-x86/processor_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ extern void detect_ht(struct cpuinfo_x86 *c);
static inline void detect_ht(struct cpuinfo_x86 *c) {}
#endif

#define load_cr3(pgdir) write_cr3(__pa(pgdir))

/*
* Save the cr4 feature set we're using (ie
Expand Down

0 comments on commit c72dcf8

Please sign in to comment.