More cleaning ...
[linux-2.6/linux-mips.git] / include / asm-parisc / mmu_context.h
blob6327156282f2c467d67bf5cddebb7327401ac581
1 #ifndef __PARISC_MMU_CONTEXT_H
2 #define __PARISC_MMU_CONTEXT_H
4 #include <linux/mm.h>
5 #include <asm/atomic.h>
6 #include <asm/pgalloc.h>
7 #include <asm/pgtable.h>
9 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
13 /* on PA-RISC, we actually have enough contexts to justify an allocator
14 * for them. prumpf */
16 extern unsigned long alloc_sid(void);
17 extern void free_sid(unsigned long);
19 static inline int
20 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
22 if (atomic_read(&mm->mm_users) != 1)
23 BUG();
25 mm->context = alloc_sid();
26 return 0;
29 static inline void
30 destroy_context(struct mm_struct *mm)
32 free_sid(mm->context);
33 mm->context = 0;
36 static inline void load_context(mm_context_t context)
38 mtsp(context, 3);
39 #if SPACEID_SHIFT == 0
40 mtctl(context << 1,8);
41 #else
42 mtctl(context >> (SPACEID_SHIFT - 1),8);
43 #endif
46 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
49 if (prev != next) {
50 mtctl(__pa(next->pgd), 25);
51 load_context(next->context);
55 #define deactivate_mm(tsk,mm) do { } while (0)
57 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
60 * Activate_mm is our one chance to allocate a space id
61 * for a new mm created in the exec path. There's also
62 * some lazy tlb stuff, which is currently dead code, but
63 * we only allocate a space id if one hasn't been allocated
64 * already, so we should be OK.
67 if (next == &init_mm) BUG(); /* Should never happen */
69 if (next->context == 0)
70 next->context = alloc_sid();
72 switch_mm(prev,next,current);
74 #endif