summaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/mmu_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc/mmu_context.h')
-rw-r--r--include/asm-ppc/mmu_context.h42
1 files changed, 29 insertions, 13 deletions
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index 50fa27081..a7e0a5246 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -20,15 +20,15 @@
*/
#ifdef CONFIG_8xx
-#define NO_CONTEXT 16
-#define LAST_CONTEXT 15
+#define NO_CONTEXT 16
+#define LAST_CONTEXT 15
#define MUNGE_CONTEXT(n) (n)
#else
/* PPC 6xx, 7xx CPUs */
-#define NO_CONTEXT 0
-#define LAST_CONTEXT 0xfffff
+#define NO_CONTEXT 0
+#define LAST_CONTEXT 0xfffff
/*
* Allocating context numbers this way tends to spread out
@@ -41,18 +41,25 @@
extern atomic_t next_mmu_context;
extern void mmu_context_overflow(void);
-#ifndef CONFIG_8xx
+/*
+ * Set the current MMU context.
+ * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by
+ * loading up the segment registers for the user part of the address space.
+ */
extern void set_context(int context);
-#else
-#define set_context(context) do { } while (0)
+
+#ifdef CONFIG_8xx
+extern inline void mmu_context_overflow(void)
+{
+ atomic_set(&next_mmu_context, -1);
+}
#endif
/*
* Get a new mmu context for task tsk if necessary.
*/
-#define get_mmu_context(tsk) \
+#define get_mmu_context(mm) \
do { \
- struct mm_struct *mm = (tsk)->mm; \
if (mm->context == NO_CONTEXT) { \
if (atomic_read(&next_mmu_context) == LAST_CONTEXT) \
mmu_context_overflow(); \
@@ -63,21 +70,30 @@ do { \
/*
* Set up the context for a new address space.
*/
-#define init_new_context(mm) ((mm)->context = NO_CONTEXT)
+#define init_new_context(tsk,mm) ((mm)->context = NO_CONTEXT)
/*
* We're finished using the context for an address space.
*/
#define destroy_context(mm) do { } while (0)
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+ struct task_struct *tsk, int cpu)
+{
+ tsk->thread.pgdir = next->pgd;
+ get_mmu_context(next);
+ set_context(next->context);
+}
+
/*
* After we have set current->mm to a new value, this activates
* the context for the new mm so we see the new mappings.
*/
-extern inline void activate_context(struct task_struct *tsk)
+static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm)
{
- get_mmu_context(tsk);
- set_context(tsk->mm->context);
+ current->thread.pgdir = mm->pgd;
+ get_mmu_context(mm);
+ set_context(mm->context);
}
/*