18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
38c2ecf20Sopenharmony_ci * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
48c2ecf20Sopenharmony_ci * Copyright (C) 1999 Silicon Graphics, Inc.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * based on MIPS asm/mmu_context.h
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
98c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
108c2ecf20Sopenharmony_ci * for more details.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef _ASM_NIOS2_MMU_CONTEXT_H
148c2ecf20Sopenharmony_ci#define _ASM_NIOS2_MMU_CONTEXT_H
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/mm_types.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#include <asm-generic/mm_hooks.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciextern void mmu_context_init(void);
218c2ecf20Sopenharmony_ciextern unsigned long get_pid_from_context(mm_context_t *ctx);
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/*
248c2ecf20Sopenharmony_ci * For the fast tlb miss handlers, we keep a pointer to the current pgd.
258c2ecf20Sopenharmony_ci * processor.
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ciextern pgd_t *pgd_current;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci}
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/*
348c2ecf20Sopenharmony_ci * Initialize the context related info for a new mm_struct instance.
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * Set all new contexts to 0, that way the generation will never match
378c2ecf20Sopenharmony_ci * the currently running generation when this context is switched in.
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_cistatic inline int init_new_context(struct task_struct *tsk,
408c2ecf20Sopenharmony_ci					struct mm_struct *mm)
418c2ecf20Sopenharmony_ci{
428c2ecf20Sopenharmony_ci	mm->context = 0;
438c2ecf20Sopenharmony_ci	return 0;
448c2ecf20Sopenharmony_ci}
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*
478c2ecf20Sopenharmony_ci * Destroy context related info for an mm_struct that is about
488c2ecf20Sopenharmony_ci * to be put to rest.
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_cistatic inline void destroy_context(struct mm_struct *mm)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_civoid switch_mm(struct mm_struct *prev, struct mm_struct *next,
558c2ecf20Sopenharmony_ci		struct task_struct *tsk);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistatic inline void deactivate_mm(struct task_struct *tsk,
588c2ecf20Sopenharmony_ci				struct mm_struct *mm)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci}
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/*
638c2ecf20Sopenharmony_ci * After we have set current->mm to a new value, this activates
648c2ecf20Sopenharmony_ci * the context for the new mm so we see the new mappings.
658c2ecf20Sopenharmony_ci */
668c2ecf20Sopenharmony_civoid activate_mm(struct mm_struct *prev, struct mm_struct *next);
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#endif /* _ASM_NIOS2_MMU_CONTEXT_H */
69