From 46e045034336a2cc90c1798cd7cc07af744ddfd6 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 19 Apr 2000 04:00:00 +0000 Subject: Merge with Linux 2.3.99-pre4. --- arch/ppc/mm/fault.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'arch/ppc/mm/fault.c') diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c index 0427f2166..5fee4463b 100644 --- a/arch/ppc/mm/fault.c +++ b/arch/ppc/mm/fault.c @@ -182,34 +182,44 @@ bad_page_fault(struct pt_regs *regs, unsigned long address) #ifdef CONFIG_8xx -unsigned long va_to_phys(unsigned long address) +/* The pgtable.h claims some functions generically exist, but I + * can't find them...... + */ +pte_t *find_pte(struct mm_struct *mm, unsigned long address) { pgd_t *dir; pmd_t *pmd; pte_t *pte; - - dir = pgd_offset(current->mm, address & PAGE_MASK); - if (dir) - { + + dir = pgd_offset(mm, address & PAGE_MASK); + if (dir) { pmd = pmd_offset(dir, address & PAGE_MASK); - if (pmd && pmd_present(*pmd)) - { + if (pmd && pmd_present(*pmd)) { pte = pte_offset(pmd, address & PAGE_MASK); - if (pte && pte_present(*pte)) - { - return(pte_page(*pte) | (address & ~(PAGE_MASK-1))); + if (pte && pte_present(*pte)) { + return(pte); } - } else - { + } + else { return (0); } - } else - { + } + else { return (0); } return (0); } +unsigned long va_to_phys(unsigned long address) +{ + pte_t *pte; + + pte = find_pte(current->mm, address); + if (pte) + return((unsigned long)(pte_page(*pte)) | (address & ~(PAGE_MASK-1))); + return (0); +} + void print_8xx_pte(struct mm_struct *mm, unsigned long addr) { @@ -227,8 +237,8 @@ print_8xx_pte(struct mm_struct *mm, unsigned long addr) printk(" (0x%08lx)->(0x%08lx)->0x%08lx\n", (long)pgd, (long)pte, (long)pte_val(*pte)); #define pp ((long)pte_val(*pte)) - printk(" RPN: %05x PP: %x SPS: %x SH: %x " - "CI: %x v: %x\n", + printk(" RPN: %05x PP: %x SPS: %x SH: %lx " + "CI: %lx v: %lx\n", pp>>12, /* rpn */ (pp>>10)&3, /* pp */ (pp>>3)&1, /* small */ -- cgit v1.2.3