1 #ifndef __M68K_MMU_CONTEXT_H
2 #define __M68K_MMU_CONTEXT_H
5 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
11 #include <asm/setup.h>
13 #include <asm/pgalloc.h>
15 static inline int init_new_context(struct task_struct *tsk,
18 mm->context = virt_to_phys(mm->pgd);
22 #define destroy_context(mm) do { } while(0)
24 static inline void switch_mm_0230(struct mm_struct *mm)
26 unsigned long crp[2] = {
27 0x80000000 | _PAGE_TABLE, mm->context
31 asm volatile (".chip 68030");
33 /* flush MC68030/MC68020 caches (they are virtually addressed) */
38 : "=d" (tmp) : "di" (FLUSH_I_AND_D));
40 /* Switch the root pointer. For a 030-only kernel,
41 * avoid flushing the whole ATC, we only need to
42 * flush the user entries. The 68851 does this by
43 * itself. Avoid a runtime check here.
46 #ifdef CPU_M68030_ONLY
54 asm volatile (".chip 68k");
57 static inline void switch_mm_0460(struct mm_struct *mm)
59 asm volatile (".chip 68040");
61 /* flush address translation cache (user entries) */
62 asm volatile ("pflushan");
64 /* switch the root pointer */
65 asm volatile ("movec %0,%%urp" : : "r" (mm->context));
70 /* clear user entries in the branch cache */
75 : "=d" (tmp): "di" (0x00200000));
78 asm volatile (".chip 68k");
81 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
84 if (CPU_IS_020_OR_030)
91 #define deactivate_mm(tsk,mm) do { } while (0)
93 static inline void activate_mm(struct mm_struct *prev_mm,
94 struct mm_struct *next_mm)
96 next_mm->context = virt_to_phys(next_mm->pgd);
98 if (CPU_IS_020_OR_030)
99 switch_mm_0230(next_mm);
101 switch_mm_0460(next_mm);
104 #else /* CONFIG_SUN3 */
105 #include <asm/sun3mmu.h>
106 #include <linux/sched.h>
108 extern unsigned long get_free_context(struct mm_struct *mm);
109 extern void clear_context(unsigned long context);
111 /* set the context for a new task to unmapped */
112 static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
114 mm->context = SUN3_INVALID_CONTEXT;
118 /* find the context given to this process, and if it hasn't already
119 got one, go get one for it. */
120 static inline void get_mmu_context(struct mm_struct *mm)
122 if(mm->context == SUN3_INVALID_CONTEXT)
123 mm->context = get_free_context(mm);
126 /* flush context if allocated... */
127 static inline void destroy_context(struct mm_struct *mm)
129 if(mm->context != SUN3_INVALID_CONTEXT)
130 clear_context(mm->context);
133 static inline void activate_context(struct mm_struct *mm)
136 sun3_put_context(mm->context);
139 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
141 activate_context(tsk->mm);
144 #define deactivate_mm(tsk,mm) do { } while (0)
146 static inline void activate_mm(struct mm_struct *prev_mm,
147 struct mm_struct *next_mm)
149 activate_context(next_mm);