~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-mips/mmu_context.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* $Id: mmu_context.h,v 1.7 2000/02/04 07:40:53 ralf Exp $
  2  *
  3  * Switch a MMU context.
  4  *
  5  * This file is subject to the terms and conditions of the GNU General Public
  6  * License.  See the file "COPYING" in the main directory of this archive
  7  * for more details.
  8  *
  9  * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
 10  * Copyright (C) 1999 Silicon Graphics, Inc.
 11  */
 12 #ifndef _ASM_MMU_CONTEXT_H
 13 #define _ASM_MMU_CONTEXT_H
 14 
 15 #include <linux/config.h>
 16 #include <asm/pgalloc.h>
 17 
 18 /* Fuck.  The f-word is here so you can grep for it :-)  */
 19 extern unsigned long asid_cache;
 20 extern pgd_t *current_pgd;
 21 
 22 #if defined(CONFIG_CPU_R3000)
 23 
 24 #define ASID_INC        0x40
 25 #define ASID_MASK       0xfc0
 26 
 27 #else /* FIXME: not correct for R6000, R8000 */
 28 
 29 #define ASID_INC        0x1
 30 #define ASID_MASK       0xff
 31 
 32 #endif
 33 
 34 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
 35 {
 36 }
 37 
 38 /*
 39  *  All unused by hardware upper bits will be considered
 40  *  as a software asid extension.
 41  */
 42 #define ASID_VERSION_MASK  ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
 43 #define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
 44 
 45 extern inline void
 46 get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
 47 {
 48         if (! ((asid += ASID_INC) & ASID_MASK) ) {
 49                 flush_tlb_all(); /* start new asid cycle */
 50                 if (!asid)      /* fix version if needed */
 51                         asid = ASID_FIRST_VERSION;
 52         }
 53         mm->context = asid_cache = asid;
 54 }
 55 
 56 /*
 57  * Initialize the context related info for a new mm_struct
 58  * instance.
 59  */
 60 extern inline int
 61 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 62 {
 63         mm->context = 0;
 64         return 0;
 65 }
 66 
 67 extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 68                              struct task_struct *tsk, unsigned cpu)
 69 {
 70         unsigned long asid = asid_cache;
 71 
 72         /* Check if our ASID is of an older version and thus invalid */
 73         if ((next->context ^ asid) & ASID_VERSION_MASK)
 74                 get_new_mmu_context(next, asid);
 75 
 76         current_pgd = next->pgd;
 77         set_entryhi(next->context);
 78 }
 79 
 80 /*
 81  * Destroy context related info for an mm_struct that is about
 82  * to be put to rest.
 83  */
 84 extern inline void destroy_context(struct mm_struct *mm)
 85 {
 86         /* Nothing to do.  */
 87 }
 88 
 89 /*
 90  * After we have set current->mm to a new value, this activates
 91  * the context for the new mm so we see the new mappings.
 92  */
 93 extern inline void
 94 activate_mm(struct mm_struct *prev, struct mm_struct *next)
 95 {
 96         /* Unconditionally get a new ASID.  */
 97         get_new_mmu_context(next, asid_cache);
 98 
 99         current_pgd = next->pgd;
100         set_entryhi(next->context);
101 }
102 
103 #endif /* _ASM_MMU_CONTEXT_H */
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.