/* * Virtual Page Number mask
*/ #define MMU_VPN_MASK 0xfffff000
#include <asm/mmu_context_32.h>
/* * Get MMU context if needed.
*/ staticinlinevoid get_mmu_context(struct mm_struct *mm, unsignedint cpu)
{ unsignedlong asid = asid_cache(cpu);
/* Check if we have old version of context. */ if (((cpu_context(cpu, mm) ^ asid) & MMU_CONTEXT_VERSION_MASK) == 0) /* It's up to date, do nothing */ return;
/* It's old, we need to get new context with new version. */ if (!(++asid & MMU_CONTEXT_ASID_MASK)) { /* * We exhaust ASID of this version. * Flush all TLB and start new cycle.
*/
local_flush_tlb_all();
/* * Fix version; Note that we avoid version #0 * to distinguish NO_CONTEXT.
*/ if (!asid)
asid = MMU_CONTEXT_FIRST_VERSION;
}
cpu_context(cpu, mm) = asid_cache(cpu) = asid;
}
/* * Initialize the context related info for a new mm_struct * instance.
*/ #define init_new_context init_new_context staticinlineint init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{ int i;
/* * After we have set current->mm to a new value, this activates * the context for the new mm so we see the new mappings.
*/ staticinlinevoid activate_context(struct mm_struct *mm, unsignedint cpu)
{
get_mmu_context(mm, cpu);
set_asid(cpu_asid(cpu, mm));
}
if (likely(prev != next)) {
cpumask_set_cpu(cpu, mm_cpumask(next));
set_TTB(next->pgd);
activate_context(next, cpu);
} else if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)))
activate_context(next, cpu);
}
#include <asm-generic/mmu_context.h>
#else
#define set_asid(asid) do { } while (0) #define get_asid() (0) #define cpu_asid(cpu, mm) ({ (void)cpu; NO_CONTEXT; }) #define switch_and_save_asid(asid) (0) #define set_TTB(pgd) do { } while (0) #define get_TTB() (0)
#include <asm-generic/nommu_context.h>
#endif/* CONFIG_MMU */
#ifdefined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4) /* * If this processor has an MMU, we need methods to turn it off/on .. * paging_init() will also have to be updated for the processor in * question.
*/ staticinlinevoid enable_mmu(void)
{ unsignedint cpu = smp_processor_id();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.