1#ifndef __PARISC_MMU_CONTEXT_H
2#define __PARISC_MMU_CONTEXT_H
3
4#include <asm/pgalloc.h>
5
6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
7{
8}
9
10/* on PA-RISC, we actually have enough contexts to justify an allocator
11 * for them.  prumpf */
12
13extern unsigned long alloc_sid(void);
14extern void free_sid(unsigned long);
15
16static inline int
17init_new_context(struct task_struct *tsk, struct mm_struct *mm)
18{
19	if (atomic_read(&mm->mm_users) != 1)
20	    BUG();
21
22	mm->context = alloc_sid();
23	return 0;
24}
25
26static inline void
27destroy_context(struct mm_struct *mm)
28{
29	free_sid(mm->context);
30	mm->context = 0;
31}
32
33static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
34{
35
36	if (prev != next) {
37		mtctl(__pa(next->pgd), 25);
38		load_context(next->context);
39	}
40}
41
42static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
43{
44	/*
45	 * Activate_mm is our one chance to allocate a space id
46	 * for a new mm created in the exec path. There's also
47	 * some lazy tlb stuff, which is currently dead code, but
48	 * we only allocate a space id if one hasn't been allocated
49	 * already, so we should be OK.
50	 */
51
52	if (next == &init_mm) BUG(); /* Should never happen */
53
54	if (next->context == 0)
55	    next->context = alloc_sid();
56
57	switch_mm(prev,next,current,0);
58}
59#endif
60