aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorThiemo Seufer <ths@networkno.de>2005-04-01 09:07:13 -0500
committerRalf Baechle <ralf@linux-mips.org>2005-10-29 14:31:00 -0400
commit1b3a6e975cbe81c5abc55e4c1b9f5b5250c5f20e (patch)
tree541db3912172f82d30244cf215b1a1b91d8c6f7f /include/asm-mips
parent7c2740f1c1a7ff2767a92042f39edad7fad95c92 (diff)
Fix 64bit SMP TLB handler and stack frame handling, optimize 32bit SMP
TLB handlers a bit, match definitions in pgtable-{32,64}.h better. Signed-off-by: Thiemo Seufer <ths@networkno.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/mmu_context.h4
-rw-r--r--include/asm-mips/pgtable-64.h10
-rw-r--r--include/asm-mips/stackframe.h10
3 files changed, 12 insertions, 12 deletions
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 45cd72d172e8..19cdf7642e66 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -30,7 +30,7 @@ extern unsigned long pgd_current[];
30 30
31#ifdef CONFIG_32BIT 31#ifdef CONFIG_32BIT
32#define TLBMISS_HANDLER_SETUP() \ 32#define TLBMISS_HANDLER_SETUP() \
33 write_c0_context((unsigned long) smp_processor_id() << 23); \ 33 write_c0_context((unsigned long) smp_processor_id() << 25); \
34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
35#endif 35#endif
36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
@@ -40,7 +40,7 @@ extern unsigned long pgd_current[];
40#endif 40#endif
41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
42#define TLBMISS_HANDLER_SETUP() \ 42#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 23); \ 43 write_c0_context((unsigned long) smp_processor_id() << 26); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
45#endif 45#endif
46 46
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 35007250ac2b..3e0a522c0f0e 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -114,7 +114,7 @@ extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
114extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD]; 114extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
115 115
116/* 116/*
117 * Empty pmd entries point to the invalid_pte_table. 117 * Empty pgd/pmd entries point to the invalid_pte_table.
118 */ 118 */
119static inline int pmd_none(pmd_t pmd) 119static inline int pmd_none(pmd_t pmd)
120{ 120{
@@ -156,7 +156,8 @@ static inline void pud_clear(pud_t *pudp)
156 pud_val(*pudp) = ((unsigned long) invalid_pmd_table); 156 pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
157} 157}
158 158
159#define pte_page(x) pfn_to_page((unsigned long)((pte_val(x) >> PAGE_SHIFT))) 159#define pte_page(x) pfn_to_page(pte_pfn(x))
160
160#ifdef CONFIG_CPU_VR41XX 161#ifdef CONFIG_CPU_VR41XX
161#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) 162#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
162#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) 163#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
@@ -167,12 +168,14 @@ static inline void pud_clear(pud_t *pudp)
167 168
168#define __pgd_offset(address) pgd_index(address) 169#define __pgd_offset(address) pgd_index(address)
169#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) 170#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
171#define __pmd_offset(address) pmd_index(address)
170#define page_pte(page) page_pte_prot(page, __pgprot(0)) 172#define page_pte(page) page_pte_prot(page, __pgprot(0))
171 173
172/* to find an entry in a kernel page-table-directory */ 174/* to find an entry in a kernel page-table-directory */
173#define pgd_offset_k(address) pgd_offset(&init_mm, 0) 175#define pgd_offset_k(address) pgd_offset(&init_mm, 0)
174 176
175#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 177#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
178#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
176 179
177/* to find an entry in a page-table-directory */ 180/* to find an entry in a page-table-directory */
178#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) 181#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
@@ -185,8 +188,7 @@ static inline unsigned long pud_page(pud_t pud)
185/* Find an entry in the second-level page table.. */ 188/* Find an entry in the second-level page table.. */
186static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) 189static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
187{ 190{
188 return (pmd_t *) pud_page(*pud) + 191 return (pmd_t *) pud_page(*pud) + pmd_index(address);
189 ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
190} 192}
191 193
192/* Find an entry in the third-level page table.. */ 194/* Find an entry in the third-level page table.. */
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index e33e302c3429..de303e96260e 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -60,7 +60,6 @@
60 mfc0 k0, CP0_CONTEXT 60 mfc0 k0, CP0_CONTEXT
61 lui k1, %hi(kernelsp) 61 lui k1, %hi(kernelsp)
62 srl k0, k0, 23 62 srl k0, k0, 23
63 sll k0, k0, 2
64 addu k1, k0 63 addu k1, k0
65 LONG_L k1, %lo(kernelsp)(k1) 64 LONG_L k1, %lo(kernelsp)(k1)
66#endif 65#endif
@@ -76,12 +75,12 @@
76#endif 75#endif
77#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 76#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
78 MFC0 k1, CP0_CONTEXT 77 MFC0 k1, CP0_CONTEXT
79 dsrl k1, 23
80 dsll k1, k1, 3
81 lui k0, %highest(kernelsp) 78 lui k0, %highest(kernelsp)
79 dsrl k1, 23
82 daddiu k0, %higher(kernelsp) 80 daddiu k0, %higher(kernelsp)
83 dsll k0, k0, 16 81 dsll k0, k0, 16
84 daddiu k0, %hi(kernelsp) 82 daddiu k0, %hi(kernelsp)
83 dsll k0, k0, 16
85 daddu k1, k1, k0 84 daddu k1, k1, k0
86 LONG_L k1, %lo(kernelsp)(k1) 85 LONG_L k1, %lo(kernelsp)(k1)
87#endif 86#endif
@@ -91,7 +90,6 @@
91#ifdef CONFIG_32BIT 90#ifdef CONFIG_32BIT
92 mfc0 \temp, CP0_CONTEXT 91 mfc0 \temp, CP0_CONTEXT
93 srl \temp, 23 92 srl \temp, 23
94 sll \temp, 2
95 LONG_S \stackp, kernelsp(\temp) 93 LONG_S \stackp, kernelsp(\temp)
96#endif 94#endif
97#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 95#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
@@ -102,8 +100,8 @@
102 LONG_S \stackp, %lo(kernelsp)(\temp) 100 LONG_S \stackp, %lo(kernelsp)(\temp)
103#endif 101#endif
104#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 102#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
105 lw \temp, TI_CPU(gp) 103 MFC0 \temp, CP0_CONTEXT
106 dsll \temp, 3 104 dsrl \temp, 23
107 LONG_S \stackp, kernelsp(\temp) 105 LONG_S \stackp, kernelsp(\temp)
108#endif 106#endif
109 .endm 107 .endm