diff options
Diffstat (limited to 'include/asm-i386/mmu_context.h')
-rw-r--r-- | include/asm-i386/mmu_context.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h index e8b812e2f..cd142e995 100644 --- a/include/asm-i386/mmu_context.h +++ b/include/asm-i386/mmu_context.h @@ -1,13 +1,33 @@ #ifndef __I386_MMU_CONTEXT_H #define __I386_MMU_CONTEXT_H +#include <asm/desc.h> +#include <asm/atomic.h> + /* - * get a new mmu context.. x86's don't know about contexts. + * possibly do the LDT unload here? */ -#define get_mmu_context(x) do { } while (0) +#define destroy_context(mm) do { } while(0) +#define init_new_context(tsk,mm) do { } while (0) + +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu) +{ + + if (prev != next) { + /* + * Re-load LDT if necessary + */ + if (prev->segments != next->segments) + load_LDT(next); + + /* Re-load page tables */ + asm volatile("movl %0,%%cr3": :"r" (__pa(next->pgd))); + clear_bit(cpu, &prev->cpu_vm_mask); + } + set_bit(cpu, &next->cpu_vm_mask); +} -#define init_new_context(mm) do { } while(0) -#define destroy_context(mm) do { } while(0) -#define activate_context(tsk) do { } while(0) +#define activate_mm(prev, next) \ + switch_mm((prev),(next),NULL,smp_processor_id()) #endif |