aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pgtable_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/pgtable_32.c')
-rw-r--r--arch/powerpc/mm/pgtable_32.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index bca560374927..d8232b7a08f7 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -261,7 +261,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
261 int err = -ENOMEM; 261 int err = -ENOMEM;
262 262
263 /* Use upper 10 bits of VA to index the first level map */ 263 /* Use upper 10 bits of VA to index the first level map */
264 pd = pmd_offset(pgd_offset_k(va), va); 264 pd = pmd_offset(pud_offset(pgd_offset_k(va), va), va);
265 /* Use middle 10 bits of VA to index the second-level map */ 265 /* Use middle 10 bits of VA to index the second-level map */
266 pg = pte_alloc_kernel(pd, va); 266 pg = pte_alloc_kernel(pd, va);
267 if (pg != 0) { 267 if (pg != 0) {
@@ -354,23 +354,27 @@ int
354get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp) 354get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp)
355{ 355{
356 pgd_t *pgd; 356 pgd_t *pgd;
357 pud_t *pud;
357 pmd_t *pmd; 358 pmd_t *pmd;
358 pte_t *pte; 359 pte_t *pte;
359 int retval = 0; 360 int retval = 0;
360 361
361 pgd = pgd_offset(mm, addr & PAGE_MASK); 362 pgd = pgd_offset(mm, addr & PAGE_MASK);
362 if (pgd) { 363 if (pgd) {
363 pmd = pmd_offset(pgd, addr & PAGE_MASK); 364 pud = pud_offset(pgd, addr & PAGE_MASK);
364 if (pmd_present(*pmd)) { 365 if (pud && pud_present(*pud)) {
365 pte = pte_offset_map(pmd, addr & PAGE_MASK); 366 pmd = pmd_offset(pud, addr & PAGE_MASK);
366 if (pte) { 367 if (pmd_present(*pmd)) {
367 retval = 1; 368 pte = pte_offset_map(pmd, addr & PAGE_MASK);
368 *ptep = pte; 369 if (pte) {
369 if (pmdp) 370 retval = 1;
370 *pmdp = pmd; 371 *ptep = pte;
371 /* XXX caller needs to do pte_unmap, yuck */ 372 if (pmdp)
372 } 373 *pmdp = pmd;
373 } 374 /* XXX caller needs to do pte_unmap, yuck */
375 }
376 }
377 }
374 } 378 }
375 return(retval); 379 return(retval);
376} 380}