Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / include / asm-parisc / mmu_context.h
blob64531f986c8276a0858401db8e9dad86ddb8e2d1
1 #ifndef __PARISC_MMU_CONTEXT_H
2 #define __PARISC_MMU_CONTEXT_H
4 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
8 /* on PA-RISC, we actually have enough contexts to justify an allocator
9 * for them. prumpf */
11 extern unsigned long alloc_sid(void);
12 extern void free_sid(unsigned long);
14 static inline int
15 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
18 * Init_new_context can be called for a cloned mm, so we
19 * only allocate a space id if one hasn't been allocated
20 * yet AND mm != &init_mm (cloned kernel thread which
21 * will run in the kernel space with spaceid 0).
24 if ((mm != &init_mm) && (mm->context == 0)) {
25 mm->context = alloc_sid();
28 return 0;
31 static inline void
32 destroy_context(struct mm_struct *mm)
34 free_sid(mm->context);
35 mm->context = 0;
38 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
41 if (prev != next) {
42 /* Re-load page tables */
43 tsk->thread.pg_tables = __pa(next->pgd);
45 mtctl(tsk->thread.pg_tables, 25);
46 mtsp(next->context,3);
50 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
53 * Activate_mm is our one chance to allocate a space id
54 * for a new mm created in the exec path. There's also
55 * some lazy tlb stuff, which is currently dead code, but
56 * we only allocate a space id if one hasn't been allocated
57 * already, so we should be OK.
60 if (next == &init_mm) BUG(); /* Should never happen */
62 if (next->context == 0)
63 next->context = alloc_sid();
65 switch_mm(prev,next,current,0);
67 #endif