Hi, MMU address space holes are at a fixed position (ofcourse). This diff makes sure the FIXED position flag is specified when mapping them in and complains loudly otherwise.
While there, check some other flag mistakes (which don't happen in the kernel). This diff prepares for the vmmap replacement I wrote, but is correct regardless. Ok? -- Ariane Index: arch/sparc/sparc/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/sparc/sparc/pmap.c,v retrieving revision 1.158 diff -u -d -p -r1.158 pmap.c --- arch/sparc/sparc/pmap.c 6 Dec 2010 20:57:18 -0000 1.158 +++ arch/sparc/sparc/pmap.c 20 Apr 2011 23:34:10 -0000 @@ -6275,7 +6275,8 @@ pmap_remove_holes(struct vm_map *map) (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)); + UVM_ADV_RANDOM, + UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } #endif } Index: arch/sparc64/sparc64/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/pmap.c,v retrieving revision 1.72 diff -u -d -p -r1.72 pmap.c --- arch/sparc64/sparc64/pmap.c 7 Apr 2011 15:30:16 -0000 1.72 +++ arch/sparc64/sparc64/pmap.c 20 Apr 2011 23:34:12 -0000 @@ -3614,7 +3614,8 @@ pmap_remove_holes(struct vm_map *map) (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)); + UVM_ADV_RANDOM, + UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } #ifdef DDB Index: arch/vax/vax/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/vax/vax/pmap.c,v retrieving revision 1.50 diff -u -d -p -r1.50 pmap.c --- arch/vax/vax/pmap.c 30 Sep 2008 20:00:29 -0000 1.50 +++ arch/vax/vax/pmap.c 20 Apr 2011 23:34:12 -0000 @@ -426,7 +426,8 @@ pmap_remove_holes(struct vm_map *map) (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)); + UVM_ADV_RANDOM, + UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } void Index: uvm/uvm_map.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_map.c,v retrieving revision 1.134 diff -u -d -p -r1.134 uvm_map.c --- uvm/uvm_map.c 18 Apr 2011 19:23:46 -0000 1.134 +++ uvm/uvm_map.c 20 Apr 2011 23:34:12 -0000 @@ -744,6 +744,14 @@ uvm_map_p(struct vm_map *map, vaddr_t *s map, *startp, size, flags); UVMHIST_LOG(maphist, " uobj/offset %p/%ld", uobj, (u_long)uoffset,0,0); + /* + * Holes are incompatible with other types of mappings. + */ + if (flags & UVM_FLAG_HOLE) { + KASSERT(uobj == NULL && (flags & UVM_FLAG_FIXED) != 0 && + (flags & (UVM_FLAG_OVERLAY | UVM_FLAG_COPYONW)) == 0); + } + #ifdef KVA_GUARDPAGES if (map == kernel_map && !(flags & UVM_FLAG_FIXED)) { /*