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 1671995e4dSLey Foon Tan #include <asm-generic/mm_hooks.h> 1771995e4dSLey Foon Tan 1871995e4dSLey Foon Tan extern void mmu_context_init(void); 1971995e4dSLey Foon Tan extern unsigned long get_pid_from_context(mm_context_t *ctx); 2071995e4dSLey Foon Tan 2171995e4dSLey Foon Tan /* 2271995e4dSLey Foon Tan * For the fast tlb miss handlers, we keep a pointer to the current pgd. 2371995e4dSLey Foon Tan * processor. 2471995e4dSLey Foon Tan */ 2571995e4dSLey Foon Tan extern pgd_t *pgd_current; 2671995e4dSLey Foon Tan 2771995e4dSLey Foon Tan static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 2871995e4dSLey Foon Tan { 2971995e4dSLey Foon Tan } 3071995e4dSLey Foon Tan 3171995e4dSLey Foon Tan /* 3271995e4dSLey Foon Tan * Initialize the context related info for a new mm_struct instance. 3371995e4dSLey Foon Tan * 3471995e4dSLey Foon Tan * Set all new contexts to 0, that way the generation will never match 3571995e4dSLey Foon Tan * the currently running generation when this context is switched in. 3671995e4dSLey Foon Tan */ 3771995e4dSLey Foon Tan static inline int init_new_context(struct task_struct *tsk, 3871995e4dSLey Foon Tan struct mm_struct *mm) 3971995e4dSLey Foon Tan { 4071995e4dSLey Foon Tan mm->context = 0; 4171995e4dSLey Foon Tan return 0; 4271995e4dSLey Foon Tan } 4371995e4dSLey Foon Tan 4471995e4dSLey Foon Tan /* 4571995e4dSLey Foon Tan * Destroy context related info for an mm_struct that is about 4671995e4dSLey Foon Tan * to be put to rest. 4771995e4dSLey Foon Tan */ 4871995e4dSLey Foon Tan static inline void destroy_context(struct mm_struct *mm) 4971995e4dSLey Foon Tan { 5071995e4dSLey Foon Tan } 5171995e4dSLey Foon Tan 5271995e4dSLey Foon Tan void switch_mm(struct mm_struct *prev, struct mm_struct *next, 5371995e4dSLey Foon Tan struct task_struct *tsk); 5471995e4dSLey Foon Tan 5571995e4dSLey Foon Tan static inline void deactivate_mm(struct task_struct *tsk, 5671995e4dSLey Foon Tan struct mm_struct *mm) 5771995e4dSLey Foon Tan { 5871995e4dSLey Foon Tan } 5971995e4dSLey Foon Tan 6071995e4dSLey Foon Tan /* 6171995e4dSLey Foon Tan * After we have set current->mm to a new value, this activates 6271995e4dSLey Foon Tan * the context for the new mm so we see the new mappings. 6371995e4dSLey Foon Tan */ 6471995e4dSLey Foon Tan void activate_mm(struct mm_struct *prev, struct mm_struct *next); 6571995e4dSLey Foon Tan 6671995e4dSLey Foon Tan #endif /* _ASM_NIOS2_MMU_CONTEXT_H */ 67