#ifndef __PPC_MMU_CONTEXT_H
#define __PPC_MMU_CONTEXT_H
+#include <linux/config.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
#include <asm/mmu.h>
#else
/* PPC 6xx, 7xx CPUs */
-#define NO_CONTEXT ((unsigned long) -1)
+#define NO_CONTEXT ((mm_context_t) -1)
#define LAST_CONTEXT 32767
#define FIRST_CONTEXT 1
#endif
* can be used for debugging on all processors (if you happen to have
* an Abatron).
*/
-extern void set_context(unsigned long contextid, pgd_t *pgd);
+extern void set_context(mm_context_t context, pgd_t *pgd);
/*
* Bitmap of contexts in use.
* Its use is an optimization only, we can't rely on this context
* number to be free, but it usually will be.
*/
-extern unsigned long next_mmu_context;
+extern mm_context_t next_mmu_context;
/*
* If we don't have sufficient contexts to give one to every task
*/
static inline void get_mmu_context(struct mm_struct *mm)
{
- unsigned long ctx;
+ mm_context_t ctx;
- if (mm->context.id != NO_CONTEXT)
+ if (mm->context != NO_CONTEXT)
return;
#ifdef FEW_CONTEXTS
while (atomic_dec_if_positive(&nr_free_contexts) < 0)
ctx = 0;
}
next_mmu_context = (ctx + 1) & LAST_CONTEXT;
- mm->context.id = ctx;
+ mm->context = ctx;
#ifdef FEW_CONTEXTS
context_mm[ctx] = mm;
#endif
/*
* Set up the context for a new address space.
*/
-static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
-{
- mm->context.id = NO_CONTEXT;
- mm->context.vdso_base = 0;
- return 0;
-}
+#define init_new_context(tsk,mm) (((mm)->context = NO_CONTEXT), 0)
/*
* We're finished using the context for an address space.
static inline void destroy_context(struct mm_struct *mm)
{
preempt_disable();
- if (mm->context.id != NO_CONTEXT) {
- clear_bit(mm->context.id, context_map);
- mm->context.id = NO_CONTEXT;
+ if (mm->context != NO_CONTEXT) {
+ clear_bit(mm->context, context_map);
+ mm->context = NO_CONTEXT;
#ifdef FEW_CONTEXTS
atomic_inc(&nr_free_contexts);
#endif
/* Setup new userspace context */
get_mmu_context(next);
- set_context(next->context.id, next->pgd);
+ set_context(next->context, next->pgd);
}
#define deactivate_mm(tsk,mm) do { } while (0)