]> rtime.felk.cvut.cz Git - mcf548x/linux.git/blobdiff - arch/m68k/mm/cf-mmu.c
Fixes (asm, entry, irq, linker, defconfig)
[mcf548x/linux.git] / arch / m68k / mm / cf-mmu.c
index 629e7a2cab57b46935f1c3cc99ddf6e03cd71f8b..ce58496afd46785a7019583fc7e0caf6db059997 100644 (file)
@@ -233,4 +233,28 @@ void __init mmu_context_init(void)
        atomic_set(&nr_free_contexts, LAST_CONTEXT - FIRST_CONTEXT + 1);
 }
 
+/*
+ * Steal a context from a task that has one at the moment.
+ * This is only used on 8xx and 4xx and we presently assume that
+ * they don't do SMP.  If they do then thicfpgalloc.hs will have to check
+ * whether the MM we steal is in use.
+ * We also assume that this is only used on systems that don't
+ * use an MMU hash table - this is true for 8xx and 4xx.
+ * This isn't an LRU system, it just frees up each context in
+ * turn (sort-of pseudo-random replacement :).  This would be the
+ * place to implement an LRU scheme if anyone was motivated to do it.
+ *  -- paulus
+ */
+void steal_context(void)
+{
+       struct mm_struct *mm;
+       /* free up context `next_mmu_context' */
+       /* if we shouldn't free context 0, don't... */
+       if (next_mmu_context < FIRST_CONTEXT)
+               next_mmu_context = FIRST_CONTEXT;
+       mm = context_mm[next_mmu_context];
+       flush_tlb_mm(mm);
+       destroy_context(mm);
+}
+