1 #ifndef __PARISC_MMU_CONTEXT_H
2 #define __PARISC_MMU_CONTEXT_H
3
4 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
5 {
6 }
7
8 /* on PA-RISC, we actually have enough contexts to justify an allocator
9 * for them. prumpf */
10
11 extern unsigned long alloc_sid(void);
12 extern void free_sid(unsigned long);
13
14 static inline int
15 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
16 {
17 /*
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).
22 */
23
24 if ((mm != &init_mm) && (mm->context == 0)) {
25 mm->context = alloc_sid();
26 }
27
28 return 0;
29 }
30
31 static inline void
32 destroy_context(struct mm_struct *mm)
33 {
34 free_sid(mm->context);
35 mm->context = 0;
36 }
37
38 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
39 {
40
41 if (prev != next) {
42 /* Re-load page tables */
43 tsk->thread.pg_tables = __pa(next->pgd);
44
45 mtctl(tsk->thread.pg_tables, 25);
46 mtsp(next->context,3);
47 }
48 }
49
50 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
51 {
52 /*
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.
58 */
59
60 if (next == &init_mm) BUG(); /* Should never happen */
61
62 if (next->context == 0)
63 next->context = alloc_sid();
64
65 switch_mm(prev,next,current,0);
66 }
67 #endif
68
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.