# ifdef __KERNEL__ /* * This function defines the mapping from contexts to VSIDs (virtual * segment IDs). We use a skew on both the context and the high 4 bits * of the 32-bit virtual address (the "effective segment ID") in order * to spread out the entries in the MMU hash table.
*/ # define CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
& 0xffffff)
/* MicroBlaze has 256 contexts, so we can just rotate through these as a way of "switching" contexts. If the TID of the TLB is zero, the PID/TID comparison is disabled, so we can use a TID of zero to represent all kernel pages as shared among all contexts.
*/
/* * Set the current MMU context. * This is done byloading up the segment registers for the user part of the * address space. * * Since the PGD is immediately available, it is much faster to simply * pass this along as a second parameter, which is required for 8xx and * can be used for debugging on all processors (if you happen to have * an Abatron).
*/ externvoid set_context(mm_context_t context, pgd_t *pgd);
/* * Bitmap of contexts in use. * The size of this bitmap is LAST_CONTEXT + 1 bits.
*/ externunsignedlong context_map[];
/* * This caches the next context number that we expect to be free. * Its use is an optimization only, we can't rely on this context * number to be free, but it usually will be.
*/ extern mm_context_t next_mmu_context;
/* * Since we don't have sufficient contexts to give one to every task * that could be in the system, we need to be able to steal contexts. * These variables support that.
*/ extern atomic_t nr_free_contexts; externstruct mm_struct *context_mm[LAST_CONTEXT+1]; externvoid steal_context(void);
/* * Get a new mmu context for the address space described by `mm'.
*/ staticinlinevoid get_mmu_context(struct mm_struct *mm)
{
mm_context_t ctx;
/* * After we have set current->mm to a new value, this activates * the context for the new mm so we see the new mappings.
*/ #define activate_mm activate_mm staticinlinevoid activate_mm(struct mm_struct *active_mm, struct mm_struct *mm)
{
current->thread.pgdir = mm->pgd;
get_mmu_context(mm);
set_context(mm->context, mm->pgd);
}
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.