aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/include/asm/mmu_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/include/asm/mmu_context.h')
-rw-r--r--arch/parisc/include/asm/mmu_context.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h
new file mode 100644
index 000000000000..85856c74ad1d
--- /dev/null
+++ b/arch/parisc/include/asm/mmu_context.h
@@ -0,0 +1,75 @@
1#ifndef __PARISC_MMU_CONTEXT_H
2#define __PARISC_MMU_CONTEXT_H
3
4#include <linux/mm.h>
5#include <linux/sched.h>
6#include <asm/atomic.h>
7#include <asm/pgalloc.h>
8#include <asm/pgtable.h>
9#include <asm-generic/mm_hooks.h>
10
11static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
12{
13}
14
15/* on PA-RISC, we actually have enough contexts to justify an allocator
16 * for them. prumpf */
17
18extern unsigned long alloc_sid(void);
19extern void free_sid(unsigned long);
20
21static inline int
22init_new_context(struct task_struct *tsk, struct mm_struct *mm)
23{
24 BUG_ON(atomic_read(&mm->mm_users) != 1);
25
26 mm->context = alloc_sid();
27 return 0;
28}
29
30static inline void
31destroy_context(struct mm_struct *mm)
32{
33 free_sid(mm->context);
34 mm->context = 0;
35}
36
37static inline void load_context(mm_context_t context)
38{
39 mtsp(context, 3);
40#if SPACEID_SHIFT == 0
41 mtctl(context << 1,8);
42#else
43 mtctl(context >> (SPACEID_SHIFT - 1),8);
44#endif
45}
46
47static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
48{
49
50 if (prev != next) {
51 mtctl(__pa(next->pgd), 25);
52 load_context(next->context);
53 }
54}
55
56#define deactivate_mm(tsk,mm) do { } while (0)
57
58static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
59{
60 /*
61 * Activate_mm is our one chance to allocate a space id
62 * for a new mm created in the exec path. There's also
63 * some lazy tlb stuff, which is currently dead code, but
64 * we only allocate a space id if one hasn't been allocated
65 * already, so we should be OK.
66 */
67
68 BUG_ON(next == &init_mm); /* Should never happen */
69
70 if (next->context == 0)
71 next->context = alloc_sid();
72
73 switch_mm(prev,next,current);
74}
75#endif