diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-07-24 16:25:34 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-07-24 16:25:34 +0000 |
commit | c6fbb46493abf59104b81880b06e24172254946c (patch) | |
tree | b895c57aa9c6facdfa3731017482569580600944 | |
parent | c40dee760bf4df2778d8083fdcc66acdbeab3a5d (diff) |
Make pmap_extract() work for large pages.
-rw-r--r-- | sys/arch/hppa64/hppa64/pmap.c | 9 | ||||
-rw-r--r-- | sys/arch/hppa64/include/pte.h | 5 |
2 files changed, 10 insertions, 4 deletions
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" |