summaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/mmu_context.h
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
committerMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
commite2819e52a162873ff5061de81bb749831bdb5de9 (patch)
tree6067ea700202750ba335a423696f2972700e5f76 /include/asm-ppc/mmu_context.h
parent17a005074429bbf143e40401f405ae4363e56828 (diff)
Merge to 2.1.38.
IMPORTANT NOTE: I could not figure out what information is the one that should be used for the following files (ie, those that were in our tree, or those that came from Linus' patch), please, check these: include/asm-mips/jazz.h include/asm-mips/jazzdma.h include/asm-mips/ioctls.h
Diffstat (limited to 'include/asm-ppc/mmu_context.h')
-rw-r--r--include/asm-ppc/mmu_context.h56
1 files changed, 51 insertions, 5 deletions
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index f4bd1e84f..89a649bb3 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -1,13 +1,59 @@
#ifndef __PPC_MMU_CONTEXT_H
#define __PPC_MMU_CONTEXT_H
+/* the way contexts are handled on the ppc they are vsid's and
+ don't need any special treatment right now.
+ perhaps I can defer flushing the tlb by keeping a list of
+ zombie vsid/context's and handling that through destroy_context
+ later -- Cort
+ */
+
+#define NO_CONTEXT 0
+#define LAST_CONTEXT 0xfffff
+
+extern int next_mmu_context;
+extern void mmu_context_overflow(void);
+extern void set_context(int context);
+
/*
- * get a new mmu context.. PowerPC's don't know about contexts [yet]
+ * Allocating context numbers this way tends to spread out
+ * the entries in the hash table better than a simple linear
+ * allocation.
*/
-#define get_mmu_context(x) do { } while (0)
+#define MUNGE_CONTEXT(n) (((n) * 897) & LAST_CONTEXT)
-#define init_new_context(mm) do { } while(0)
-#define destroy_context(mm) do { } while(0)
+/*
+ * Get a new mmu context for task tsk if necessary.
+ */
+#define get_mmu_context(tsk) \
+do { \
+ struct mm_struct *mm = (tsk)->mm; \
+ if (mm->context == NO_CONTEXT) { \
+ int i; \
+ if (next_mmu_context == LAST_CONTEXT) \
+ mmu_context_overflow(); \
+ mm->context = MUNGE_CONTEXT(++next_mmu_context);\
+ if ( tsk == current ) \
+ set_context(mm->context); \
+ } \
+} while (0)
-#endif
+/*
+ * Set up the context for a new address space.
+ */
+#define init_new_context(mm) ((mm)->context = NO_CONTEXT)
+
+/*
+ * We're finished using the context for an address space.
+ */
+#define destroy_context(mm) do { } while (0)
+/*
+ * compute the vsid from the context and segment
+ * segments > 7 are kernel segments and their
+ * vsid is the segment -- Cort
+ */
+#define VSID_FROM_CONTEXT(segment,context) \
+ ((segment < 8) ? ((segment) | (context)<<4) : (segment))
+
+#endif