1 #ifndef __I386_MMU_CONTEXT_H
2 #define __I386_MMU_CONTEXT_H
4 #include <linux/config.h>
6 #include <asm/atomic.h>
7 #include <asm/pgalloc.h>
10 * possibly do the LDT unload here?
12 #define destroy_context(mm) do { } while(0)
13 #define init_new_context(tsk,mm) 0
17 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
19 if(cpu_tlbstate[cpu].state == TLBSTATE_OK)
20 cpu_tlbstate[cpu].state = TLBSTATE_LAZY;
23 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
28 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
31 /* stop flush ipis for the previous mm */
32 clear_bit(cpu, &prev->cpu_vm_mask);
34 * Re-load LDT if necessary
36 if (prev->context.segments != next->context.segments)
39 cpu_tlbstate[cpu].state = TLBSTATE_OK;
40 cpu_tlbstate[cpu].active_mm = next;
42 set_bit(cpu, &next->cpu_vm_mask);
43 set_bit(cpu, &next->context.cpuvalid);
44 /* Re-load page tables */
49 cpu_tlbstate[cpu].state = TLBSTATE_OK;
50 if(cpu_tlbstate[cpu].active_mm != next)
52 if(!test_and_set_bit(cpu, &next->cpu_vm_mask)) {
53 /* We were in lazy tlb mode and leave_mm disabled
54 * tlb flush IPI delivery. We must reload %cr3.
58 if (!test_and_set_bit(cpu, &next->context.cpuvalid))
64 #define activate_mm(prev, next) \
65 switch_mm((prev),(next),NULL,smp_processor_id())