171995e4dSLey Foon Tan /*
271995e4dSLey Foon Tan * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
371995e4dSLey Foon Tan * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
471995e4dSLey Foon Tan * Copyright (C) 1999 Silicon Graphics, Inc.
571995e4dSLey Foon Tan *
671995e4dSLey Foon Tan * based on MIPS asm/mmu_context.h
771995e4dSLey Foon Tan *
871995e4dSLey Foon Tan * This file is subject to the terms and conditions of the GNU General Public
971995e4dSLey Foon Tan * License. See the file "COPYING" in the main directory of this archive
1071995e4dSLey Foon Tan * for more details.
1171995e4dSLey Foon Tan */
1271995e4dSLey Foon Tan
1371995e4dSLey Foon Tan #ifndef _ASM_NIOS2_MMU_CONTEXT_H
1471995e4dSLey Foon Tan #define _ASM_NIOS2_MMU_CONTEXT_H
1571995e4dSLey Foon Tan
16589ee628SIngo Molnar #include <linux/mm_types.h>
17589ee628SIngo Molnar
1871995e4dSLey Foon Tan #include <asm-generic/mm_hooks.h>
1971995e4dSLey Foon Tan
2071995e4dSLey Foon Tan extern void mmu_context_init(void);
2171995e4dSLey Foon Tan extern unsigned long get_pid_from_context(mm_context_t *ctx);
2271995e4dSLey Foon Tan
2371995e4dSLey Foon Tan /*
2471995e4dSLey Foon Tan * For the fast tlb miss handlers, we keep a pointer to the current pgd.
2571995e4dSLey Foon Tan * processor.
2671995e4dSLey Foon Tan */
2771995e4dSLey Foon Tan extern pgd_t *pgd_current;
2871995e4dSLey Foon Tan
2971995e4dSLey Foon Tan /*
3071995e4dSLey Foon Tan * Initialize the context related info for a new mm_struct instance.
3171995e4dSLey Foon Tan *
3271995e4dSLey Foon Tan * Set all new contexts to 0, that way the generation will never match
3371995e4dSLey Foon Tan * the currently running generation when this context is switched in.
3471995e4dSLey Foon Tan */
35*e2e251ccSNicholas Piggin #define init_new_context init_new_context
init_new_context(struct task_struct * tsk,struct mm_struct * mm)3671995e4dSLey Foon Tan static inline int init_new_context(struct task_struct *tsk,
3771995e4dSLey Foon Tan struct mm_struct *mm)
3871995e4dSLey Foon Tan {
3971995e4dSLey Foon Tan mm->context = 0;
4071995e4dSLey Foon Tan return 0;
4171995e4dSLey Foon Tan }
4271995e4dSLey Foon Tan
4371995e4dSLey Foon Tan void switch_mm(struct mm_struct *prev, struct mm_struct *next,
4471995e4dSLey Foon Tan struct task_struct *tsk);
4571995e4dSLey Foon Tan
4671995e4dSLey Foon Tan /*
4771995e4dSLey Foon Tan * After we have set current->mm to a new value, this activates
4871995e4dSLey Foon Tan * the context for the new mm so we see the new mappings.
4971995e4dSLey Foon Tan */
50*e2e251ccSNicholas Piggin #define activate_mm activate_mm
5171995e4dSLey Foon Tan void activate_mm(struct mm_struct *prev, struct mm_struct *next);
5271995e4dSLey Foon Tan
53*e2e251ccSNicholas Piggin #include <asm-generic/mmu_context.h>
54*e2e251ccSNicholas Piggin
5571995e4dSLey Foon Tan #endif /* _ASM_NIOS2_MMU_CONTEXT_H */
56