From: kettenis Date: Sat, 24 Jul 2010 16:25:33 +0000 (+0000) Subject: Make pmap_extract() work for large pages. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c0080829ef77d99abc8d5fbf6db7f20c18b0354a;p=openbsd Make pmap_extract() work for large pages. --- diff --git a/sys/arch/hppa64/hppa64/pmap.c b/sys/arch/hppa64/hppa64/pmap.c index 9c1661c101f..f70689af73c 100644 --- a/sys/arch/hppa64/hppa64/pmap.c +++ b/sys/arch/hppa64/hppa64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.12 2010/07/02 22:47:54 jsing Exp $ */ +/* $OpenBSD: pmap.c,v 1.13 2010/07/24 16:25:33 kettenis Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -1057,6 +1057,7 @@ pmap_extract(pmap, va, pap) paddr_t *pap; { pt_entry_t pte; + vaddr_t mask; DPRINTF(PDB_FOLLOW|PDB_EXTRACT, ("pmap_extract(%p, %lx)\n", pmap, va)); @@ -1065,8 +1066,10 @@ pmap_extract(pmap, va, pap) simple_unlock(&pmap->pm_lock); if (pte) { - if (pap) - *pap = PTE_PAGE(pte) | (va & PAGE_MASK); + if (pap) { + mask = PTE_PAGE_SIZE(pte) - 1; + *pap = PTE_PAGE(pte) | (va & mask); + } return (TRUE); } diff --git a/sys/arch/hppa64/include/pte.h b/sys/arch/hppa64/include/pte.h index 31f93949320..5fb756019f8 100644 --- a/sys/arch/hppa64/include/pte.h +++ b/sys/arch/hppa64/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.2 2010/07/24 14:30:04 kettenis Exp $ */ +/* $OpenBSD: pte.h,v 1.3 2010/07/24 16:25:33 kettenis Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -57,6 +57,9 @@ #define PTE_PG16M 0x0000000000000006UL #define PTE_PG64M 0x0000000000000007UL +#define PTE_PAGE_SHIFT(pte) (12 + (2 * ((pte) & PTE_PG64M))) +#define PTE_PAGE_SIZE(pte) (1 << PTE_PAGE_SHIFT(pte)) + #define PTE_GETBITS(pte) ((pte) >> 48) #define PTE_BITS \ "\020\01H\02P\03O\04UC\05U\010W\11X\12G\014B\015D\016REF\017FD\020FI"