aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-05-07 22:46:49 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-07 23:40:31 -0400
commitd1953c8888ef034b912ee33bc2ea2cce6a414402 (patch)
tree525e581603a2dd8622b821304440b6ce14b535ae /arch/powerpc/mm
parent00c2ae35bd50664bcd841becc6efceef8aa5d074 (diff)
[POWERPC] Remove use of 4level-fixup.h for ppc32
For 32-bit systems, powerpc still relies on the 4level-fixup.h hack, to pretend that the generic pagetable handling stuff is 3-levels rather than 4. This patch removes this, instead using the newer pgtable-nopmd.h to handle the elision of both the pud and pmd pagetable levels (ppc32 pagetables are actually 2 levels). This removes a little extraneous code, and makes it more easily compared to the 64-bit pagetable code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm')
-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}