aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lib-32/dump_tlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lib-32/dump_tlb.c')
-rw-r--r--arch/mips/lib-32/dump_tlb.c106
1 files changed, 65 insertions, 41 deletions
diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c
index 019ac8f005d7..46519f4331eb 100644
--- a/arch/mips/lib-32/dump_tlb.c
+++ b/arch/mips/lib-32/dump_tlb.c
@@ -20,16 +20,25 @@
20static inline const char *msk2str(unsigned int mask) 20static inline const char *msk2str(unsigned int mask)
21{ 21{
22 switch (mask) { 22 switch (mask) {
23 case PM_4K: return "4kb"; 23 case PM_4K:
24 case PM_16K: return "16kb"; 24 return "4kb";
25 case PM_64K: return "64kb"; 25 case PM_16K:
26 case PM_256K: return "256kb"; 26 return "16kb";
27 case PM_64K:
28 return "64kb";
29 case PM_256K:
30 return "256kb";
27#ifndef CONFIG_CPU_VR41XX 31#ifndef CONFIG_CPU_VR41XX
28 case PM_1M: return "1Mb"; 32 case PM_1M:
29 case PM_4M: return "4Mb"; 33 return "1Mb";
30 case PM_16M: return "16Mb"; 34 case PM_4M:
31 case PM_64M: return "64Mb"; 35 return "4Mb";
32 case PM_256M: return "256Mb"; 36 case PM_16M:
37 return "16Mb";
38 case PM_64M:
39 return "64Mb";
40 case PM_256M:
41 return "256Mb";
33#endif 42#endif
34 } 43 }
35 44
@@ -47,7 +56,7 @@ void dump_tlb(int first, int last)
47 unsigned int pagemask, c0, c1, asid; 56 unsigned int pagemask, c0, c1, asid;
48 unsigned long long entrylo0, entrylo1; 57 unsigned long long entrylo0, entrylo1;
49 unsigned long entryhi; 58 unsigned long entryhi;
50 int i; 59 int i;
51 60
52 asid = read_c0_entryhi() & 0xff; 61 asid = read_c0_entryhi() & 0xff;
53 62
@@ -58,7 +67,7 @@ void dump_tlb(int first, int last)
58 tlb_read(); 67 tlb_read();
59 BARRIER(); 68 BARRIER();
60 pagemask = read_c0_pagemask(); 69 pagemask = read_c0_pagemask();
61 entryhi = read_c0_entryhi(); 70 entryhi = read_c0_entryhi();
62 entrylo0 = read_c0_entrylo0(); 71 entrylo0 = read_c0_entrylo0();
63 entrylo1 = read_c0_entrylo1(); 72 entrylo1 = read_c0_entrylo1();
64 73
@@ -78,13 +87,11 @@ void dump_tlb(int first, int last)
78 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n", 87 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n",
79 (entrylo0 << 6) & PAGE_MASK, c0, 88 (entrylo0 << 6) & PAGE_MASK, c0,
80 (entrylo0 & 4) ? 1 : 0, 89 (entrylo0 & 4) ? 1 : 0,
81 (entrylo0 & 2) ? 1 : 0, 90 (entrylo0 & 2) ? 1 : 0, (entrylo0 & 1));
82 (entrylo0 & 1));
83 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n", 91 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n",
84 (entrylo1 << 6) & PAGE_MASK, c1, 92 (entrylo1 << 6) & PAGE_MASK, c1,
85 (entrylo1 & 4) ? 1 : 0, 93 (entrylo1 & 4) ? 1 : 0,
86 (entrylo1 & 2) ? 1 : 0, 94 (entrylo1 & 2) ? 1 : 0, (entrylo1 & 1));
87 (entrylo1 & 1));
88 printk("\n"); 95 printk("\n");
89 } 96 }
90 } 97 }
@@ -99,7 +106,7 @@ void dump_tlb_all(void)
99 106
100void dump_tlb_wired(void) 107void dump_tlb_wired(void)
101{ 108{
102 int wired; 109 int wired;
103 110
104 wired = read_c0_wired(); 111 wired = read_c0_wired();
105 printk("Wired: %d", wired); 112 printk("Wired: %d", wired);
@@ -138,9 +145,10 @@ void dump_tlb_nonwired(void)
138 145
139void dump_list_process(struct task_struct *t, void *address) 146void dump_list_process(struct task_struct *t, void *address)
140{ 147{
141 pgd_t *page_dir, *pgd; 148 pgd_t *page_dir, *pgd;
142 pmd_t *pmd; 149 pud_t *pud;
143 pte_t *pte, page; 150 pmd_t *pmd;
151 pte_t *pte, page;
144 unsigned long addr, val; 152 unsigned long addr, val;
145 153
146 addr = (unsigned long) address; 154 addr = (unsigned long) address;
@@ -152,21 +160,27 @@ void dump_list_process(struct task_struct *t, void *address)
152 160
153 if (addr > KSEG0) 161 if (addr > KSEG0)
154 page_dir = pgd_offset_k(0); 162 page_dir = pgd_offset_k(0);
155 else 163 else if (t->mm) {
156 page_dir = pgd_offset(t->mm, 0); 164 page_dir = pgd_offset(t->mm, 0);
157 printk("page_dir == %08x\n", (unsigned int) page_dir); 165 printk("page_dir == %08x\n", (unsigned int) page_dir);
166 } else
167 printk("Current thread has no mm\n");
158 168
159 if (addr > KSEG0) 169 if (addr > KSEG0)
160 pgd = pgd_offset_k(addr); 170 pgd = pgd_offset_k(addr);
161 else 171 else if (t->mm) {
162 pgd = pgd_offset(t->mm, addr); 172 pgd = pgd_offset(t->mm, addr);
163 printk("pgd == %08x, ", (unsigned int) pgd); 173 printk("pgd == %08x, ", (unsigned int) pgd);
174 pud = pud_offset(pgd, addr);
175 printk("pud == %08x, ", (unsigned int) pud);
164 176
165 pmd = pmd_offset(pgd, addr); 177 pmd = pmd_offset(pud, addr);
166 printk("pmd == %08x, ", (unsigned int) pmd); 178 printk("pmd == %08x, ", (unsigned int) pmd);
167 179
168 pte = pte_offset(pmd, addr); 180 pte = pte_offset(pmd, addr);
169 printk("pte == %08x, ", (unsigned int) pte); 181 printk("pte == %08x, ", (unsigned int) pte);
182 } else
183 printk("Current thread has no mm\n");
170 184
171 page = *pte; 185 page = *pte;
172#ifdef CONFIG_64BIT_PHYS_ADDR 186#ifdef CONFIG_64BIT_PHYS_ADDR
@@ -176,14 +190,22 @@ void dump_list_process(struct task_struct *t, void *address)
176#endif 190#endif
177 191
178 val = pte_val(page); 192 val = pte_val(page);
179 if (val & _PAGE_PRESENT) printk("present "); 193 if (val & _PAGE_PRESENT)
180 if (val & _PAGE_READ) printk("read "); 194 printk("present ");
181 if (val & _PAGE_WRITE) printk("write "); 195 if (val & _PAGE_READ)
182 if (val & _PAGE_ACCESSED) printk("accessed "); 196 printk("read ");
183 if (val & _PAGE_MODIFIED) printk("modified "); 197 if (val & _PAGE_WRITE)
184 if (val & _PAGE_R4KBUG) printk("r4kbug "); 198 printk("write ");
185 if (val & _PAGE_GLOBAL) printk("global "); 199 if (val & _PAGE_ACCESSED)
186 if (val & _PAGE_VALID) printk("valid "); 200 printk("accessed ");
201 if (val & _PAGE_MODIFIED)
202 printk("modified ");
203 if (val & _PAGE_R4KBUG)
204 printk("r4kbug ");
205 if (val & _PAGE_GLOBAL)
206 printk("global ");
207 if (val & _PAGE_VALID)
208 printk("valid ");
187 printk("\n"); 209 printk("\n");
188} 210}
189 211
@@ -194,14 +216,16 @@ void dump_list_current(void *address)
194 216
195unsigned int vtop(void *address) 217unsigned int vtop(void *address)
196{ 218{
197 pgd_t *pgd; 219 pgd_t *pgd;
198 pmd_t *pmd; 220 pud_t *pud;
199 pte_t *pte; 221 pmd_t *pmd;
222 pte_t *pte;
200 unsigned int addr, paddr; 223 unsigned int addr, paddr;
201 224
202 addr = (unsigned long) address; 225 addr = (unsigned long) address;
203 pgd = pgd_offset(current->mm, addr); 226 pgd = pgd_offset(current->mm, addr);
204 pmd = pmd_offset(pgd, addr); 227 pud = pud_offset(pgd, addr);
228 pmd = pmd_offset(pud, addr);
205 pte = pte_offset(pmd, addr); 229 pte = pte_offset(pmd, addr);
206 paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK; 230 paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK;
207 paddr |= (addr & ~PAGE_MASK); 231 paddr |= (addr & ~PAGE_MASK);
@@ -214,9 +238,9 @@ void dump16(unsigned long *p)
214 int i; 238 int i;
215 239
216 for (i = 0; i < 8; i++) { 240 for (i = 0; i < 8; i++) {
217 printk("*%08lx == %08lx, ", (unsigned long)p, *p); 241 printk("*%08lx == %08lx, ", (unsigned long) p, *p);
218 p++; 242 p++;
219 printk("*%08lx == %08lx\n", (unsigned long)p, *p); 243 printk("*%08lx == %08lx\n", (unsigned long) p, *p);
220 p++; 244 p++;
221 } 245 }
222} 246}