X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-x86_64%2Fmmu_context.h;h=b630d52bdfb1e030473926b4440fc62fb0c68536;hb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;hp=410bd4067d34621189673e80cb1d8276e8f90ef7;hpb=e3f6fb6212a7102bdb56ba38fa1e98fe72950475;p=linux-2.6.git diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h index 410bd4067..b630d52bd 100644 --- a/include/asm-x86_64/mmu_context.h +++ b/include/asm-x86_64/mmu_context.h @@ -28,6 +28,11 @@ 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) { @@ -40,7 +45,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, write_pda(active_mm, next); #endif set_bit(cpu, &next->cpu_vm_mask); - asm volatile("movq %0,%%cr3" :: "r" (__pa(next->pgd)) : "memory"); + load_cr3(next->pgd); + if (unlikely(next->context.ldt != prev->context.ldt)) load_LDT_nolock(&next->context, cpu); } @@ -54,7 +60,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, * tlb flush IPI delivery. We must reload CR3 * to make sure to use no freed page tables. */ - asm volatile("movq %0,%%cr3" :: "r" (__pa(next->pgd)) : "memory"); + load_cr3(next->pgd); load_LDT_nolock(&next->context, cpu); } }