diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-06-09 20:32:57 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-06-09 20:32:57 +0000 |
commit | 9979144e9848798e61e9e3d04945a4c24c308d0d (patch) | |
tree | c3167038e2e62c360327aa3ea9548d9038574f91 /sys | |
parent | 281c01b8cbd2899a8f46ebb0a07e5c44a560cb9d (diff) |
Sparc64 MMUs have an address hole, too, and the pmap implementation we
are using has an even larger one, so implement pmap_remove_hole() to
prevent mmap() from ever reaching the hole.
feedback and ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc64/include/pmap.h | 1 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/pmap.c | 27 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h index f23ae80b702..6d90051bdb5 100644 --- a/sys/arch/sparc64/include/pmap.h +++ b/sys/arch/sparc64/include/pmap.h @@ -162,7 +162,6 @@ int pmap_count_res(pmap_t pmap); #define pmap_resident_count(pm) pmap_count_res((pm)) #define pmap_phys_address(x) (x) #define pmap_update(pm) /* nothing (yet) */ -#define pmap_remove_holes(map) do { /* nothing */ } while (0) #define pmap_proc_iflush(p,va,len) /* nothing */ diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index ee521ca528d..059418b9f10 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.61 2008/06/09 16:55:20 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.62 2008/06/09 20:32:56 miod Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ /* @@ -3626,6 +3626,31 @@ pmap_free_page(paddr_t pa, struct pmap *pm) uvm_pagefree(pg); } +void +pmap_remove_holes(struct vm_map *map) +{ + vaddr_t shole, ehole; + + /* + * Although the hardware only supports 44-bit virtual addresses + * (and thus a hole from 1 << 43 to -1 << 43), this pmap + * implementation itself only supports 43-bit virtual addresses, + * so we have to narrow the hole a bit more. + */ + shole = 1L << (HOLESHIFT - 1); + ehole = -1L << (HOLESHIFT - 1); + + shole = ulmax(vm_map_min(map), shole); + ehole = ulmin(vm_map_max(map), ehole); + + if (ehole <= shole) + return; + + (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0, + UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, + UVM_ADV_RANDOM, UVM_FLAG_NOMERGE | UVM_FLAG_HOLE)); +} + #ifdef DDB void db_dump_pv(db_expr_t, int, db_expr_t, char *); |