diff options
Diffstat (limited to 'arch/mips/include/asm/mmu_context.h')
-rw-r--r-- | arch/mips/include/asm/mmu_context.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index 6083db586500..145bb81ccaa5 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
@@ -24,6 +24,33 @@ | |||
24 | #endif /* SMTC */ | 24 | #endif /* SMTC */ |
25 | #include <asm-generic/mm_hooks.h> | 25 | #include <asm-generic/mm_hooks.h> |
26 | 26 | ||
27 | #ifdef CONFIG_MIPS_PGD_C0_CONTEXT | ||
28 | |||
29 | #define TLBMISS_HANDLER_SETUP_PGD(pgd) \ | ||
30 | tlbmiss_handler_setup_pgd((unsigned long)(pgd)) | ||
31 | |||
32 | static inline void tlbmiss_handler_setup_pgd(unsigned long pgd) | ||
33 | { | ||
34 | /* Check for swapper_pg_dir and convert to physical address. */ | ||
35 | if ((pgd & CKSEG3) == CKSEG0) | ||
36 | pgd = CPHYSADDR(pgd); | ||
37 | write_c0_context(pgd << 11); | ||
38 | } | ||
39 | |||
40 | #define TLBMISS_HANDLER_SETUP() \ | ||
41 | do { \ | ||
42 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \ | ||
43 | write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ | ||
44 | } while (0) | ||
45 | |||
46 | |||
47 | static inline unsigned long get_current_pgd(void) | ||
48 | { | ||
49 | return PHYS_TO_XKSEG_CACHED((read_c0_context() >> 11) & ~0xfffUL); | ||
50 | } | ||
51 | |||
52 | #else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ | ||
53 | |||
27 | /* | 54 | /* |
28 | * For the fast tlb miss handlers, we keep a per cpu array of pointers | 55 | * For the fast tlb miss handlers, we keep a per cpu array of pointers |
29 | * to the current pgd for each processor. Also, the proc. id is stuffed | 56 | * to the current pgd for each processor. Also, the proc. id is stuffed |
@@ -46,7 +73,7 @@ extern unsigned long pgd_current[]; | |||
46 | back_to_back_c0_hazard(); \ | 73 | back_to_back_c0_hazard(); \ |
47 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) | 74 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) |
48 | #endif | 75 | #endif |
49 | 76 | #endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/ | |
50 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 77 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) |
51 | 78 | ||
52 | #define ASID_INC 0x40 | 79 | #define ASID_INC 0x40 |