1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3*4882a593Smuzhiyun * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
4*4882a593Smuzhiyun * Copyright (C) 1999 Silicon Graphics, Inc.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * based on MIPS asm/mmu_context.h
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * This file is subject to the terms and conditions of the GNU General Public
9*4882a593Smuzhiyun * License. See the file "COPYING" in the main directory of this archive
10*4882a593Smuzhiyun * for more details.
11*4882a593Smuzhiyun */
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #ifndef _ASM_NIOS2_MMU_CONTEXT_H
14*4882a593Smuzhiyun #define _ASM_NIOS2_MMU_CONTEXT_H
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun #include <linux/mm_types.h>
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #include <asm-generic/mm_hooks.h>
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun extern void mmu_context_init(void);
21*4882a593Smuzhiyun extern unsigned long get_pid_from_context(mm_context_t *ctx);
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun /*
24*4882a593Smuzhiyun * For the fast tlb miss handlers, we keep a pointer to the current pgd.
25*4882a593Smuzhiyun * processor.
26*4882a593Smuzhiyun */
27*4882a593Smuzhiyun extern pgd_t *pgd_current;
28*4882a593Smuzhiyun
enter_lazy_tlb(struct mm_struct * mm,struct task_struct * tsk)29*4882a593Smuzhiyun static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
30*4882a593Smuzhiyun {
31*4882a593Smuzhiyun }
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun /*
34*4882a593Smuzhiyun * Initialize the context related info for a new mm_struct instance.
35*4882a593Smuzhiyun *
36*4882a593Smuzhiyun * Set all new contexts to 0, that way the generation will never match
37*4882a593Smuzhiyun * the currently running generation when this context is switched in.
38*4882a593Smuzhiyun */
init_new_context(struct task_struct * tsk,struct mm_struct * mm)39*4882a593Smuzhiyun static inline int init_new_context(struct task_struct *tsk,
40*4882a593Smuzhiyun struct mm_struct *mm)
41*4882a593Smuzhiyun {
42*4882a593Smuzhiyun mm->context = 0;
43*4882a593Smuzhiyun return 0;
44*4882a593Smuzhiyun }
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun /*
47*4882a593Smuzhiyun * Destroy context related info for an mm_struct that is about
48*4882a593Smuzhiyun * to be put to rest.
49*4882a593Smuzhiyun */
destroy_context(struct mm_struct * mm)50*4882a593Smuzhiyun static inline void destroy_context(struct mm_struct *mm)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun }
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun void switch_mm(struct mm_struct *prev, struct mm_struct *next,
55*4882a593Smuzhiyun struct task_struct *tsk);
56*4882a593Smuzhiyun
deactivate_mm(struct task_struct * tsk,struct mm_struct * mm)57*4882a593Smuzhiyun static inline void deactivate_mm(struct task_struct *tsk,
58*4882a593Smuzhiyun struct mm_struct *mm)
59*4882a593Smuzhiyun {
60*4882a593Smuzhiyun }
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun /*
63*4882a593Smuzhiyun * After we have set current->mm to a new value, this activates
64*4882a593Smuzhiyun * the context for the new mm so we see the new mappings.
65*4882a593Smuzhiyun */
66*4882a593Smuzhiyun void activate_mm(struct mm_struct *prev, struct mm_struct *next);
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun #endif /* _ASM_NIOS2_MMU_CONTEXT_H */
69