diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-07 01:18:02 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-07 01:18:02 +0000 |
commit | c1c5c105f41ad5a43d2d86df94c7b57a4e86d03f (patch) | |
tree | f35ef0cfc30ec497901dac2701302652e736c1f4 | |
parent | 0cf5ca3327d0f3f051ffeeedbbf725cdb3b5b201 (diff) |
Add an alignment argument to uvm_map that specifies an alignment hint
for the virtual address.
35 files changed, 164 insertions, 122 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 79f4f783e14..9cbbd5c72e0 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.56 2001/11/06 19:53:13 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.57 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -912,7 +912,7 @@ cpu_startup() */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("startup: cannot allocate VM for buffers"); diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index ffa2dd4fd1b..2e05152b474 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.55 2001/11/06 19:53:13 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.56 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */ /* @@ -422,7 +422,7 @@ again: */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *)&buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("startup: cannot allocate buffers"); diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index f004113cac9..27e16bee96d 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.37 2001/11/06 19:53:14 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.38 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */ /*- @@ -501,14 +501,14 @@ pmap_init() addr = (vaddr_t) amigahwaddr; if (uvm_map(kernel_map, &addr, ptoa(namigahwpg), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) goto bogons; addr = (vaddr_t) Sysmap; if (uvm_map(kernel_map, &addr, AMIGA_KPTSIZE, - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) { @@ -599,7 +599,7 @@ bogons: * we already have kernel PT pages. */ addr = 0; - rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, + rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)); if (rv != KERN_SUCCESS || (addr + s) >= (vaddr_t)Sysmap) diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 0fe54e69b42..ab2532f2863 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.66 2001/11/06 00:30:38 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.67 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -292,7 +292,7 @@ cpu_startup() */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("startup: cannot allocate VM for buffers"); diff --git a/sys/arch/hp300/hp300/pmap.c b/sys/arch/hp300/hp300/pmap.c index c6b318d5c5e..03d17f50eac 100644 --- a/sys/arch/hp300/hp300/pmap.c +++ b/sys/arch/hp300/hp300/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.30 2001/11/06 01:53:42 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.31 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: pmap.c,v 1.80 1999/09/16 14:52:06 chs Exp $ */ /*- @@ -380,14 +380,14 @@ pmap_init() addr = (vaddr_t) intiobase; if (uvm_map(kernel_map, &addr, m68k_ptob(IIOMAPSIZE+EIOMAPSIZE), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) goto bogons; addr = (vaddr_t) Sysmap; if (uvm_map(kernel_map, &addr, HP_MAX_PTSIZE, - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) { @@ -461,7 +461,7 @@ pmap_init() * we already have kernel PT pages. */ addr = 0; - rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, + rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)); if (rv != KERN_SUCCESS || (addr + s) >= (vaddr_t)Sysmap) diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index e2051bd3aa0..8fcfc63fb0d 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.41 2001/11/06 19:53:14 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.42 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -614,8 +614,8 @@ cpu_startup() */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, - UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, + UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); minaddr = (vaddr_t)buffers; base = bufpages / nbuf; diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index 6b9e4fa1519..a703a9b59e2 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.15 2001/11/06 19:53:14 miod Exp $ */ +/* $OpenBSD: mainbus.c,v 1.16 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -725,7 +725,7 @@ mbus_dmamem_alloc(void *v, bus_size_t size, bus_size_t alignment, alignment, 0, &pglist, 1, FALSE)) return ENOMEM; - if (uvm_map(kernel_map, &va, size, NULL, UVM_UNKNOWN_OFFSET, + if (uvm_map(kernel_map, &va, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) != KERN_SUCCESS) { uvm_pglistfree(&pglist); diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index f8f234bca7f..306eb5271dc 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.27 2001/11/06 19:53:14 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.28 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -314,7 +314,7 @@ vmapbuf(bp, len) */ while (1) { kva = vm_map_min(phys_map); - if (uvm_map(phys_map, &kva, size, NULL, addr, + if (uvm_map(phys_map, &kva, size, NULL, addr, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) == KERN_SUCCESS) break; diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index b58ed758881..fca086e967f 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.180 2001/11/06 01:43:48 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.181 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -536,7 +536,7 @@ setup_buffers(maxaddr) size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 125f24ec8b7..b6a352e16f1 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.84 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.85 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */ /* @@ -457,8 +457,8 @@ again: */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vm_offset_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, - UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, + UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("startup: cannot allocate VM for buffers"); minaddr = (vm_offset_t)buffers; base = bufpages / nbuf; diff --git a/sys/arch/mac68k/mac68k/pmap.c b/sys/arch/mac68k/mac68k/pmap.c index 09abc463719..299f88522b1 100644 --- a/sys/arch/mac68k/mac68k/pmap.c +++ b/sys/arch/mac68k/mac68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.30 2001/11/06 02:07:59 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.31 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: pmap.c,v 1.55 1999/04/22 04:24:53 chs Exp $ */ /* @@ -338,14 +338,14 @@ pmap_init() addr = (vaddr_t)IOBase; if (uvm_map(kernel_map, &addr, m68k_ptob(IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) goto bogons; addr = (vaddr_t)Sysmap; if (uvm_map(kernel_map, &addr, MAC_MAX_PTSIZE, - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) { @@ -419,7 +419,7 @@ pmap_init() * we already have kernel PT pages. */ addr = 0; - rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, + rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)); if (rv != KERN_SUCCESS || (addr + s) >= (vaddr_t)Sysmap) diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index ee8527df884..cc5fcdb988f 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.11 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.12 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -544,7 +544,7 @@ cpu_startup() */ sz = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(sz), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 11f5fe3439c..2eb6a6b45aa 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.54 2001/09/29 21:28:02 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.55 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -341,7 +341,7 @@ again: */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, m68k_round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/mvme68k/mvme68k/pmap.c b/sys/arch/mvme68k/mvme68k/pmap.c index feb68cc6b0b..ce7cd076711 100644 --- a/sys/arch/mvme68k/mvme68k/pmap.c +++ b/sys/arch/mvme68k/mvme68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.29 2001/11/06 02:15:31 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.30 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -346,15 +346,15 @@ pmap_init() addr = (vaddr_t) intiobase; if (uvm_map(kernel_map, &addr, m68k_ptob(iiomapsize+EIOMAPSIZE), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) goto bogons; addr = (vaddr_t) Sysmap; if (uvm_map(kernel_map, &addr, M68K_MAX_PTSIZE, - NULL, UVM_UNKNOWN_OFFSET, - UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, + UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)) != KERN_SUCCESS) { /* @@ -443,7 +443,7 @@ pmap_init() * we already have kernel PT pages. */ addr = 0; - rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, + rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)); if (rv != KERN_SUCCESS || (addr + s) >= (vaddr_t)Sysmap) diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 2032e3e0475..1cbd6bb2a5c 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.63 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.64 2001/11/07 01:18:00 art Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -501,7 +501,7 @@ cpu_startup() */ uarea_pages = UADDR; uvm_map(kernel_map, (vaddr_t *)&uarea_pages, USPACE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); @@ -528,7 +528,7 @@ cpu_startup() bugromva = BUGROM_START; uvm_map(kernel_map, (vaddr_t *)&bugromva, BUGROM_SIZE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); @@ -542,7 +542,7 @@ cpu_startup() */ sramva = SRAM_START; uvm_map(kernel_map, (vaddr_t *)&sramva, SRAM_SIZE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); @@ -557,7 +557,7 @@ cpu_startup() */ obiova = OBIO_START; uvm_map(kernel_map, (vaddr_t *)&obiova, OBIO_SIZE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); @@ -574,7 +574,7 @@ cpu_startup() */ utilva = MVME188_UTILITY; uvm_map(kernel_map, (vaddr_t *)&utilva, MVME188_UTILITY_SIZE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); @@ -592,7 +592,7 @@ cpu_startup() */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c index 1e8d8c5b3a1..ed22ab23cdf 100644 --- a/sys/arch/mvmeppc/mvmeppc/machdep.c +++ b/sys/arch/mvmeppc/mvmeppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.12 2001/11/06 22:46:00 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.13 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -521,7 +521,7 @@ cpu_startup() */ sz = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(sz), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index ec2a7989416..adca01faf30 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.66 2001/11/06 02:49:22 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.67 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -209,7 +209,7 @@ cpu_startup() /* allocate VM for buffers... area is not managed by VM system */ if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index ba89e8adf20..2b95f1a5382 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.34 2001/11/06 19:53:16 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.35 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -312,7 +312,7 @@ vmapbuf(bp, sz) */ while (1) { kva = vm_map_min(kernel_map); - if (uvm_map(kernel_map, &kva, size, NULL, uva, + if (uvm_map(kernel_map, &kva, size, NULL, uva, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) == KERN_SUCCESS) break; diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index bf330f18776..c3ece3e9db5 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.19 2001/11/06 19:53:16 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.20 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -268,7 +268,7 @@ cpu_startup() /* allocate VM for buffers... area is not managed by VM system */ if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != 0) panic("cpu_startup: cannot allocate VM for buffers"); @@ -1622,7 +1622,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) * our aligment requirements. */ oversize = size + align - PAGE_SIZE; - r = uvm_map(kernel_map, &sva, oversize, NULL, UVM_UNKNOWN_OFFSET, + r = uvm_map(kernel_map, &sva, oversize, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)); if (r != 0) diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index f5efed34203..c67efa1ab62 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.43 2001/11/06 19:53:16 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.44 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* @@ -280,7 +280,7 @@ cpu_startup() */ size = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("startup: cannot allocate buffers"); diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index fcc08bdeab8..999384d08b1 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.30 2001/11/06 02:49:23 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.31 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- @@ -406,6 +406,8 @@ extern int pmap_page_index __P((paddr_t)); extern u_int pmap_free_pages __P((void)); extern int pmap_next_page __P((vm_offset_t *)); +void pmap_pinit __P((struct pmap *)); +void pmap_release __P((struct pmap *)); /* * Debugging support. diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 28742056af9..a33c022e8d5 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.42 2001/11/06 19:53:17 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.43 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -211,7 +211,7 @@ cpu_startup() /* allocate VM for buffers... area is not managed by VM system */ if (uvm_map(kernel_map, (vm_offset_t *) &buffers, round_page(size), - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != KERN_SUCCESS) panic("cpu_startup: cannot allocate VM for buffers"); diff --git a/sys/compat/osf1/osf1_mmap.c b/sys/compat/osf1/osf1_mmap.c index 7592ed1e0df..c42ff6eaf4a 100644 --- a/sys/compat/osf1/osf1_mmap.c +++ b/sys/compat/osf1/osf1_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osf1_mmap.c,v 1.4 2001/11/06 19:53:17 miod Exp $ */ +/* $OpenBSD: osf1_mmap.c,v 1.5 2001/11/07 01:18:00 art Exp $ */ /* $NetBSD: osf1_mmap.c,v 1.5 2000/04/11 05:26:27 chs Exp $ */ /* @@ -183,14 +183,14 @@ osf1_sys_mmap(p, v, retval) /* if non-NULL address given, start looking there */ /* XXX - UVM */ if (addr != 0 && uvm_map_findspace(&p->p_vmspace->vm_map, - addr, size, &addr, NULL, 0, 0) != NULL) { + addr, size, &addr, NULL, 0, 0, 0) != NULL) { fixed = 1; goto done; } /* didn't find anything. take it again from the top. */ if (uvm_map_findspace(&p->p_vmspace->vm_map, NBPG, size, &addr, - NULL, 0, 0) != NULL) { + NULL, 0, 0, 0) != NULL) { fixed = 1; goto done; } diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index 9de5cf0e3ce..b47cae762f5 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.36 2001/11/06 19:53:18 miod Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.37 2001/11/07 01:18:01 art Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -675,7 +675,7 @@ svr4_sys_break(p, v, retval) if (diff > 0) { rv = uvm_map(&vm->vm_map, &old, diff, NULL, UVM_UNKNOWN_OFFSET, - UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, + 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c index 54247d51ac7..770a29f8adc 100644 --- a/sys/kern/exec_subr.c +++ b/sys/kern/exec_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_subr.c,v 1.13 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: exec_subr.c,v 1.14 2001/11/07 01:18:01 art Exp $ */ /* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */ /* @@ -173,7 +173,7 @@ vmcmd_map_pagedvn(p, cmd) */ retval = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len, - uobj, cmd->ev_offset, + uobj, cmd->ev_offset, 0, UVM_MAPFLAG(cmd->ev_prot, VM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED)); @@ -210,7 +210,7 @@ vmcmd_map_readvn(p, cmd) cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */ error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, - round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, + round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); @@ -258,7 +258,7 @@ vmcmd_map_zero(p, cmd) cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */ error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, - round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, + round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(cmd->ev_prot, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW)); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 25c2c8d4bb5..e41148c9f95 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.82 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: init_main.c,v 1.83 2001/11/07 01:18:01 art Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -499,7 +499,7 @@ start_init(arg) addr = USRSTACK - PAGE_SIZE; #endif if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, - NULL, UVM_UNKNOWN_OFFSET, + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)) != KERN_SUCCESS) diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index c63455509ba..f7a233d632c 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.21 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.22 2001/11/07 01:18:01 art Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -253,7 +253,7 @@ sys_shmat(p, v, retval) shm_handle = shmseg->shm_internal; uao_reference(shm_handle->shm_object); rv = uvm_map(&p->p_vmspace->vm_map, &attach_va, size, - shm_handle->shm_object, 0, UVM_MAPFLAG(prot, prot, + shm_handle->shm_object, 0, 0, UVM_MAPFLAG(prot, prot, UVM_INH_SHARE, UVM_ADV_RANDOM, 0)); if (rv != KERN_SUCCESS) { return ENOMEM; diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index c294b3d2987..3f6eaa5aeb6 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_extern.h,v 1.28 2001/11/06 18:41:10 art Exp $ */ -/* $NetBSD: uvm_extern.h,v 1.48 2000/08/12 22:41:55 thorpej Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.29 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_extern.h,v 1.49 2000/09/13 15:00:25 thorpej Exp $ */ /* * @@ -486,7 +486,8 @@ void uvm_km_free_poolpage1 __P((vm_map_t, vaddr_t)); /* uvm_map.c */ int uvm_map __P((vm_map_t, vaddr_t *, vsize_t, - struct uvm_object *, voff_t, uvm_flag_t)); + struct uvm_object *, voff_t, vsize_t, + uvm_flag_t)); int uvm_map_pageable __P((vm_map_t, vaddr_t, vaddr_t, boolean_t, int)); int uvm_map_pageable_all __P((vm_map_t, int, vsize_t)); diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 3ff1ea1140a..08f373e54de 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_km.c,v 1.18 2001/11/06 13:36:52 art Exp $ */ -/* $NetBSD: uvm_km.c,v 1.38 2000/07/24 20:10:53 jeffs Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.19 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_km.c,v 1.39 2000/09/13 15:00:25 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -235,7 +235,7 @@ uvm_km_init(start, end) uvm_map_setup(&kernel_map_store, base, end, VM_MAP_PAGEABLE); kernel_map_store.pmap = pmap_kernel(); if (uvm_map(&kernel_map_store, &base, start - base, NULL, - UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, + UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM,UVM_FLAG_FIXED)) != KERN_SUCCESS) panic("uvm_km_init: could not reserve space for kernel"); @@ -273,7 +273,7 @@ uvm_km_suballoc(map, min, max, size, flags, fixed, submap) * first allocate a blank spot in the parent map */ - if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET, + if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, mapflags)) != KERN_SUCCESS) { panic("uvm_km_suballoc: unable to allocate space in parent map"); @@ -539,7 +539,7 @@ uvm_km_kmemalloc(map, obj, size, flags) */ if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET, - UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, + 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != KERN_SUCCESS)) { UVMHIST_LOG(maphist, "<- done (no VM)",0,0,0,0); @@ -684,7 +684,7 @@ uvm_km_alloc1(map, size, zeroit) */ if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object, - UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, + UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) != KERN_SUCCESS)) { UVMHIST_LOG(maphist,"<- done (no VM)",0,0,0,0); @@ -785,7 +785,7 @@ uvm_km_valloc(map, size) */ if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object, - UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, + UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) != KERN_SUCCESS)) { UVMHIST_LOG(maphist, "<- done (no VM)", 0,0,0,0); @@ -833,7 +833,7 @@ uvm_km_valloc_prefer_wait(map, size, prefer) */ if (__predict_true(uvm_map(map, &kva, size, uvm.kernel_object, - prefer, UVM_MAPFLAG(UVM_PROT_ALL, + prefer, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) == KERN_SUCCESS)) { UVMHIST_LOG(maphist,"<- done (kva=0x%x)", kva,0,0,0); diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index b754d9ccde4..d3d00972295 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_map.c,v 1.27 2001/11/06 13:36:52 art Exp $ */ -/* $NetBSD: uvm_map.c,v 1.80 2000/08/01 00:53:11 wiz Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.28 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_map.c,v 1.81 2000/09/13 15:00:25 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -456,16 +456,23 @@ uvm_map_clip_end(map, entry, end) * case [4] is for kernel mappings where we don't know the offset until * we've found a virtual address. note that kernel object offsets are * always relative to vm_map_min(kernel_map). + * + * => if `align' is non-zero, we try to align the virtual address to + * the specified alignment. this is only a hint; if we can't + * do it, the address will be unaligned. this is provided as + * a mechanism for large pages. + * * => XXXCDC: need way to map in external amap? */ int -uvm_map(map, startp, size, uobj, uoffset, flags) +uvm_map(map, startp, size, uobj, uoffset, align, flags) vm_map_t map; vaddr_t *startp; /* IN/OUT */ vsize_t size; struct uvm_object *uobj; voff_t uoffset; + vsize_t align; uvm_flag_t flags; { vm_map_entry_t prev_entry, new_entry; @@ -500,7 +507,7 @@ uvm_map(map, startp, size, uobj, uoffset, flags) vm_map_lock(map); /* could sleep here */ } if ((prev_entry = uvm_map_findspace(map, *startp, size, startp, - uobj, uoffset, flags & UVM_FLAG_FIXED)) == NULL) { + uobj, uoffset, align, flags)) == NULL) { UVMHIST_LOG(maphist,"<- uvm_map_findspace failed!",0,0,0,0); vm_map_unlock(map); return (KERN_NO_SPACE); @@ -775,39 +782,54 @@ uvm_map_lookup_entry(map, address, entry) return (FALSE); } - /* * uvm_map_findspace: find "length" sized space in "map". * - * => "hint" is a hint about where we want it, unless fixed is true - * (in which case we insist on using "hint"). + * => "hint" is a hint about where we want it, unless FINDSPACE_FIXED is + * set (in which case we insist on using "hint"). * => "result" is VA returned * => uobj/uoffset are to be used to handle VAC alignment, if required + * => if `align' is non-zero, we attempt to align to that value. * => caller must at least have read-locked map * => returns NULL on failure, or pointer to prev. map entry if success * => note this is a cross between the old vm_map_findspace and vm_map_find */ vm_map_entry_t -uvm_map_findspace(map, hint, length, result, uobj, uoffset, fixed) +uvm_map_findspace(map, hint, length, result, uobj, uoffset, align, flags) vm_map_t map; vaddr_t hint; vsize_t length; vaddr_t *result; /* OUT */ struct uvm_object *uobj; voff_t uoffset; - boolean_t fixed; + vsize_t align; + int flags; { vm_map_entry_t entry, next, tmp; - vaddr_t end; + vaddr_t end, orig_hint; UVMHIST_FUNC("uvm_map_findspace"); UVMHIST_CALLED(maphist); - UVMHIST_LOG(maphist, "(map=0x%x, hint=0x%x, len=%d, fixed=%d)", - map, hint, length, fixed); + UVMHIST_LOG(maphist, "(map=0x%x, hint=0x%x, len=%d, flags=0x%x)", + map, hint, length, flags); + +#ifdef DIAGNOSTIC + if ((align & (align - 1)) != 0) + panic("uvm_map_findspace: alignment not power of 2"); + if ((flags & UVM_FLAG_FIXED) != 0 && align != 0) + panic("uvm_map_findslace: fixed and alignment both specified"); +#endif + + /* + * remember the original hint. if we are aligning, then we + * may have to try again with no alignment constraint if + * we fail the first time. + */ + orig_hint = hint; if (hint < map->min_offset) { /* check ranges ... */ - if (fixed) { + if (flags & UVM_FLAG_FIXED) { UVMHIST_LOG(maphist,"<- VA below map range",0,0,0,0); return(NULL); } @@ -824,13 +846,13 @@ uvm_map_findspace(map, hint, length, result, uobj, uoffset, fixed) * something at this address, we have to start after it. */ - if (!fixed && hint == map->min_offset) { + if ((flags & UVM_FLAG_FIXED) == 0 && hint == map->min_offset) { if ((entry = map->first_free) != &map->header) hint = entry->end; } else { if (uvm_map_lookup_entry(map, hint, &tmp)) { /* "hint" address already in use ... */ - if (fixed) { + if (flags & UVM_FLAG_FIXED) { UVMHIST_LOG(maphist,"<- fixed & VA in use", 0, 0, 0, 0); return(NULL); @@ -860,18 +882,33 @@ uvm_map_findspace(map, hint, length, result, uobj, uoffset, fixed) * push hint forward as needed to avoid VAC alias problems. * we only do this if a valid offset is specified. */ - if (!fixed && uoffset != UVM_UNKNOWN_OFFSET) - PMAP_PREFER(uoffset, &hint); + if ((flags & UVM_FLAG_FIXED) == 0 && + uoffset != UVM_UNKNOWN_OFFSET) + PMAP_PREFER(uoffset, &hint); #endif + if (align != 0) { + if ((hint & (align - 1)) != 0) + hint = roundup(hint, align); + /* + * XXX Should we PMAP_PREFER() here again? + */ + } end = hint + length; if (end > map->max_offset || end < hint) { UVMHIST_LOG(maphist,"<- failed (off end)", 0,0,0,0); + if (align != 0) { + UVMHIST_LOG(maphist, + "calling recursively, no align", + 0,0,0,0); + return (uvm_map_findspace(map, orig_hint, + length, result, uobj, uoffset, 0, flags)); + } return (NULL); } next = entry->next; if (next == &map->header || next->start >= end) break; - if (fixed) { + if (flags & UVM_FLAG_FIXED) { UVMHIST_LOG(maphist,"<- fixed mapping failed", 0,0,0,0); return(NULL); /* only one shot at it ... */ } @@ -961,7 +998,7 @@ uvm_unmap_remove(map, start, end, entry_list) UVM_MAP_CLIP_END(map, entry, end); next = entry->next; len = entry->end - entry->start; - + /* * unwire before removing addresses from the pmap; otherwise * unwiring will put the entries back into the pmap (XXX). @@ -1156,10 +1193,11 @@ uvm_unmap_detach(first_entry, amap_unref_flags) */ int -uvm_map_reserve(map, size, offset, raddr) +uvm_map_reserve(map, size, offset, align, raddr) vm_map_t map; vsize_t size; - vaddr_t offset; /* hint for pmap_prefer */ + vaddr_t offset; /* hint for pmap_prefer */ + vsize_t align; /* alignment hint */ vaddr_t *raddr; /* IN:hint, OUT: reserved VA */ { UVMHIST_FUNC("uvm_map_reserve"); UVMHIST_CALLED(maphist); @@ -1175,7 +1213,7 @@ uvm_map_reserve(map, size, offset, raddr) * reserve some virtual space. */ - if (uvm_map(map, raddr, size, NULL, offset, + if (uvm_map(map, raddr, size, NULL, offset, 0, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != KERN_SUCCESS) { UVMHIST_LOG(maphist, "<- done (no VM)", 0,0,0,0); @@ -1353,7 +1391,7 @@ uvm_map_extract(srcmap, start, len, dstmap, dstaddrp, flags) */ dstaddr = vm_map_min(dstmap); - if (uvm_map_reserve(dstmap, len, start, &dstaddr) == FALSE) + if (uvm_map_reserve(dstmap, len, start, 0, &dstaddr) == FALSE) return(ENOMEM); *dstaddrp = dstaddr; /* pass address back to caller */ UVMHIST_LOG(maphist, " dstaddr=0x%x", dstaddr,0,0,0); diff --git a/sys/uvm/uvm_map.h b/sys/uvm/uvm_map.h index 951c282cfd7..f3ac92f0cdb 100644 --- a/sys/uvm/uvm_map.h +++ b/sys/uvm/uvm_map.h @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_map.h,v 1.12 2001/11/06 13:36:52 art Exp $ */ -/* $NetBSD: uvm_map.h,v 1.21 2000/08/16 16:32:06 thorpej Exp $ */ +/* $OpenBSD: uvm_map.h,v 1.13 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_map.h,v 1.22 2000/09/13 15:00:25 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -330,7 +330,7 @@ vm_map_t uvm_map_create __P((pmap_t, vaddr_t, vaddr_t, int)); int uvm_map_extract __P((vm_map_t, vaddr_t, vsize_t, vm_map_t, vaddr_t *, int)); vm_map_entry_t uvm_map_findspace __P((vm_map_t, vaddr_t, vsize_t, vaddr_t *, - struct uvm_object *, voff_t, boolean_t)); + struct uvm_object *, voff_t, vsize_t, int)); int uvm_map_inherit __P((vm_map_t, vaddr_t, vaddr_t, vm_inherit_t)); int uvm_map_advice __P((vm_map_t, vaddr_t, vaddr_t, int)); void uvm_map_init __P((void)); @@ -339,7 +339,8 @@ MAP_INLINE void uvm_map_reference __P((vm_map_t)); int uvm_map_replace __P((vm_map_t, vaddr_t, vaddr_t, vm_map_entry_t, int)); -int uvm_map_reserve __P((vm_map_t, vsize_t, vaddr_t, vaddr_t *)); +int uvm_map_reserve __P((vm_map_t, vsize_t, vaddr_t, vsize_t, + vaddr_t *)); void uvm_map_setup __P((vm_map_t, vaddr_t, vaddr_t, int)); int uvm_map_submap __P((vm_map_t, vaddr_t, vaddr_t, vm_map_t)); MAP_INLINE diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 44b831447fe..2aba0283ac7 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_mmap.c,v 1.23 2001/11/06 01:35:04 art Exp $ */ -/* $NetBSD: uvm_mmap.c,v 1.43 2000/06/27 17:29:28 mrg Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.24 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_mmap.c,v 1.44 2000/09/13 15:00:25 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -1211,7 +1211,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit) * do it! */ - retval = uvm_map(map, addr, size, uobj, foff, uvmflag); + retval = uvm_map(map, addr, size, uobj, foff, 0, uvmflag); if (retval == KERN_SUCCESS) { /* diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 1c2e7157baf..bc80f041f57 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.27 2001/11/06 13:36:52 art Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.28 2001/11/07 01:18:01 art Exp $ */ /* $NetBSD: uvm_page.c,v 1.40 2000/08/02 20:25:11 thorpej Exp $ */ /* @@ -1070,7 +1070,7 @@ uvm_pagealloc_contig(size, low, high, alignment) &pglist, 1, FALSE)) return 0; addr = vm_map_min(kernel_map); - if (uvm_map(kernel_map, &addr, size, NULL, UVM_UNKNOWN_OFFSET, + if (uvm_map(kernel_map, &addr, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0)) != KERN_SUCCESS) { uvm_pglistfree(&pglist); diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c index 15dce897e17..1ac5457b1fa 100644 --- a/sys/uvm/uvm_pager.c +++ b/sys/uvm/uvm_pager.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_pager.c,v 1.18 2001/11/06 01:35:04 art Exp $ */ -/* $NetBSD: uvm_pager.c,v 1.32 2000/06/27 17:29:32 mrg Exp $ */ +/* $OpenBSD: uvm_pager.c,v 1.19 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_pager.c,v 1.33 2000/09/13 15:00:25 thorpej Exp $ */ /* * @@ -153,7 +153,7 @@ ReStart: kva = 0; /* let system choose VA */ if (uvm_map(pager_map, &kva, size, NULL, - UVM_UNKNOWN_OFFSET, UVM_FLAG_NOMERGE) != KERN_SUCCESS) { + UVM_UNKNOWN_OFFSET, 0, UVM_FLAG_NOMERGE) != KERN_SUCCESS) { if ((flags & UVMPAGER_MAPIN_WAITOK) == 0) { if (aio) FREE(aio, M_TEMP); diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 1cccce72d29..294b28b0c98 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_unix.c,v 1.15 2001/11/06 13:36:52 art Exp $ */ -/* $NetBSD: uvm_unix.c,v 1.17 2000/09/07 05:01:43 chs Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.16 2001/11/07 01:18:01 art Exp $ */ +/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -96,7 +96,7 @@ sys_obreak(p, v, retval) */ if (diff > 0) { rv = uvm_map(&vm->vm_map, &old, diff, NULL, UVM_UNKNOWN_OFFSET, - UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, + 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); if (rv == KERN_SUCCESS) { |