Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / unicore32 / include / asm / mmu_context.h
blobfb5e4c658f7aef9bb695012929fdc6768d7aa801
1 /*
2 * linux/arch/unicore32/include/asm/mmu_context.h
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #ifndef __UNICORE_MMU_CONTEXT_H__
13 #define __UNICORE_MMU_CONTEXT_H__
15 #include <linux/compiler.h>
16 #include <linux/sched.h>
17 #include <linux/io.h>
19 #include <asm/cacheflush.h>
20 #include <asm/cpu-single.h>
22 #define init_new_context(tsk, mm) 0
24 #define destroy_context(mm) do { } while (0)
27 * This is called when "tsk" is about to enter lazy TLB mode.
29 * mm: describes the currently active mm context
30 * tsk: task which is entering lazy tlb
31 * cpu: cpu number which is entering lazy tlb
33 * tsk->mm will be NULL
35 static inline void
36 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
41 * This is the actual mm switch as far as the scheduler
42 * is concerned. No registers are touched. We avoid
43 * calling the CPU specific function when the mm hasn't
44 * actually changed.
46 static inline void
47 switch_mm(struct mm_struct *prev, struct mm_struct *next,
48 struct task_struct *tsk)
50 unsigned int cpu = smp_processor_id();
52 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
53 cpu_switch_mm(next->pgd, next);
56 #define deactivate_mm(tsk, mm) do { } while (0)
57 #define activate_mm(prev, next) switch_mm(prev, next, NULL)
60 * We are inserting a "fake" vma for the user-accessible vector page so
61 * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
62 * But we also want to remove it before the generic code gets to see it
63 * during process exit or the unmapping of it would cause total havoc.
64 * (the macro is used as remove_vma() is static to mm/mmap.c)
66 #define arch_exit_mmap(mm) \
67 do { \
68 struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \
69 if (high_vma) { \
70 BUG_ON(high_vma->vm_next); /* it should be last */ \
71 if (high_vma->vm_prev) \
72 high_vma->vm_prev->vm_next = NULL; \
73 else \
74 mm->mmap = NULL; \
75 rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
76 mm->mmap_cache = NULL; \
77 mm->map_count--; \
78 remove_vma(high_vma); \
79 } \
80 } while (0)
82 static inline void arch_dup_mmap(struct mm_struct *oldmm,
83 struct mm_struct *mm)
87 #endif