1 #ifndef __PARISC_MMU_CONTEXT_H
2 #define __PARISC_MMU_CONTEXT_H
5 #include <asm/atomic.h>
6 #include <asm/pgalloc.h>
7 #include <asm/pgtable.h>
8 #include <asm-generic/mm_hooks.h>
10 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
14 /* on PA-RISC, we actually have enough contexts to justify an allocator
17 extern unsigned long alloc_sid(void);
18 extern void free_sid(unsigned long);
21 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
23 BUG_ON(atomic_read(&mm->mm_users) != 1);
25 mm->context = alloc_sid();
30 destroy_context(struct mm_struct *mm)
32 free_sid(mm->context);
36 static inline void load_context(mm_context_t context)
39 #if SPACEID_SHIFT == 0
40 mtctl(context << 1,8);
42 mtctl(context >> (SPACEID_SHIFT - 1),8);
46 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
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 BUG_ON(next == &init_mm); /* Should never happen */
69 if (next->context == 0)
70 next->context = alloc_sid();
72 switch_mm(prev,next,current);