aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-01-30 07:33:42 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:42 -0500
commite66a95127dc4273d3573eb03657991f7bbd5dca3 (patch)
tree2577fb7c4d06d69dfc602b8e6c5720f1a3f97244 /arch
parent0c42f392767d3592e1cf676857d398ef69be7c9c (diff)
x86: add dump_pagetable helper to X86_32
Similar to x86 64-bit. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/mm/fault_32.c72
1 files changed, 39 insertions, 33 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index 93ede2dde95..41c31968a74 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -173,6 +173,44 @@ static void force_sig_info_fault(int si_signo, int si_code,
173 force_sig_info(si_signo, &info, tsk); 173 force_sig_info(si_signo, &info, tsk);
174} 174}
175 175
176void dump_pagetable(unsigned long address)
177{
178 __typeof__(pte_val(__pte(0))) page;
179
180 page = read_cr3();
181 page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT];
182#ifdef CONFIG_X86_PAE
183 printk("*pdpt = %016Lx ", page);
184 if ((page >> PAGE_SHIFT) < max_low_pfn
185 && page & _PAGE_PRESENT) {
186 page &= PAGE_MASK;
187 page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT)
188 & (PTRS_PER_PMD - 1)];
189 printk(KERN_CONT "*pde = %016Lx ", page);
190 page &= ~_PAGE_NX;
191 }
192#else
193 printk("*pde = %08lx ", page);
194#endif
195
196 /*
197 * We must not directly access the pte in the highpte
198 * case if the page table is located in highmem.
199 * And let's rather not kmap-atomic the pte, just in case
200 * it's allocated already.
201 */
202 if ((page >> PAGE_SHIFT) < max_low_pfn
203 && (page & _PAGE_PRESENT)
204 && !(page & _PAGE_PSE)) {
205 page &= PAGE_MASK;
206 page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
207 & (PTRS_PER_PTE - 1)];
208 printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page);
209 }
210
211 printk("\n");
212}
213
176void do_invalid_op(struct pt_regs *, unsigned long); 214void do_invalid_op(struct pt_regs *, unsigned long);
177 215
178static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) 216static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
@@ -572,7 +610,6 @@ no_context:
572 bust_spinlocks(1); 610 bust_spinlocks(1);
573 611
574 if (oops_may_print()) { 612 if (oops_may_print()) {
575 __typeof__(pte_val(__pte(0))) page;
576 613
577#ifdef CONFIG_X86_PAE 614#ifdef CONFIG_X86_PAE
578 if (error_code & PF_INSTR) { 615 if (error_code & PF_INSTR) {
@@ -593,38 +630,7 @@ no_context:
593 printk(" at virtual address %08lx\n", address); 630 printk(" at virtual address %08lx\n", address);
594 printk(KERN_ALERT "printing ip: %08lx ", regs->ip); 631 printk(KERN_ALERT "printing ip: %08lx ", regs->ip);
595 632
596 page = read_cr3(); 633 dump_pagetable(address);
597 page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT];
598#ifdef CONFIG_X86_PAE
599 printk("*pdpt = %016Lx ", page);
600 if ((page >> PAGE_SHIFT) < max_low_pfn
601 && page & _PAGE_PRESENT) {
602 page &= PAGE_MASK;
603 page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT)
604 & (PTRS_PER_PMD - 1)];
605 printk(KERN_CONT "*pde = %016Lx ", page);
606 page &= ~_PAGE_NX;
607 }
608#else
609 printk("*pde = %08lx ", page);
610#endif
611
612 /*
613 * We must not directly access the pte in the highpte
614 * case if the page table is located in highmem.
615 * And let's rather not kmap-atomic the pte, just in case
616 * it's allocated already.
617 */
618 if ((page >> PAGE_SHIFT) < max_low_pfn
619 && (page & _PAGE_PRESENT)
620 && !(page & _PAGE_PSE)) {
621 page &= PAGE_MASK;
622 page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
623 & (PTRS_PER_PTE - 1)];
624 printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page);
625 }
626
627 printk("\n");
628 } 634 }
629 635
630 tsk->thread.cr2 = address; 636 tsk->thread.cr2 = address;