0001
0002
0003 #ifndef __ASM_CSKY_MMU_CONTEXT_H
0004 #define __ASM_CSKY_MMU_CONTEXT_H
0005
0006 #include <asm-generic/mm_hooks.h>
0007 #include <asm/setup.h>
0008 #include <asm/page.h>
0009 #include <asm/cacheflush.h>
0010 #include <asm/tlbflush.h>
0011
0012 #include <linux/errno.h>
0013 #include <linux/sched.h>
0014 #include <abi/ckmmu.h>
0015
0016 #define ASID_MASK ((1 << CONFIG_CPU_ASID_BITS) - 1)
0017 #define cpu_asid(mm) (atomic64_read(&mm->context.asid) & ASID_MASK)
0018
0019 #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.asid, 0); 0; })
0020
0021 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
0022
0023 static inline void
0024 switch_mm(struct mm_struct *prev, struct mm_struct *next,
0025 struct task_struct *tsk)
0026 {
0027 unsigned int cpu = smp_processor_id();
0028
0029 if (prev != next)
0030 check_and_switch_context(next, cpu);
0031
0032 setup_pgd(next->pgd, next->context.asid.counter);
0033
0034 flush_icache_deferred(next);
0035 }
0036
0037 #include <asm-generic/mmu_context.h>
0038
0039 #endif