From: guenther Date: Mon, 15 Dec 2014 02:24:22 +0000 (+0000) Subject: Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e087cc70f4b4b7a3628652ad3c1877c3724db5bc;p=openbsd Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro, eliminating the must-be-kept-in-sync UVM_INH_* macros ok deraadt@ tedu@ --- diff --git a/sys/arch/mips64/mips64/mips64_machdep.c b/sys/arch/mips64/mips64/mips64_machdep.c index 21dd133ee49..3ddf2c1fabd 100644 --- a/sys/arch/mips64/mips64/mips64_machdep.c +++ b/sys/arch/mips64/mips64/mips64_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mips64_machdep.c,v 1.18 2014/12/13 23:29:14 guenther Exp $ */ +/* $OpenBSD: mips64_machdep.c,v 1.19 2014/12/15 02:24:22 guenther Exp $ */ /* * Copyright (c) 2009, 2010, 2012 Miodrag Vallat. @@ -184,7 +184,7 @@ exec_md_map(struct proc *p, struct exec_package *pack) va = 0; rc = uvm_map(&p->p_vmspace->vm_map, &va, PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(PROT_NONE, PROT_MASK, UVM_INH_COPY, + UVM_MAPFLAG(PROT_NONE, PROT_MASK, MAP_INHERIT_COPY, MADV_NORMAL, UVM_FLAG_COPYONW)); if (rc != 0) return rc; diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 9939cdb0c14..0adc356e74a 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.169 2014/11/22 22:51:29 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.170 2014/12/15 02:24:22 guenther Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -6277,7 +6277,7 @@ pmap_remove_holes(struct vm_map *map) (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(PROT_NONE, PROT_NONE, UVM_INH_SHARE, + UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index d550d591a8a..49bfbc0a9a4 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.83 2014/11/16 12:30:59 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.84 2014/12/15 02:24:23 guenther 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 */ /* @@ -3639,7 +3639,7 @@ pmap_remove_holes(struct vm_map *map) return; (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(PROT_NONE, PROT_NONE, UVM_INH_SHARE, + UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index d9d1acfaae2..f8643dd4fbe 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.72 2014/11/25 20:31:41 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.73 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */ /* * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden. @@ -868,7 +868,7 @@ pmap_remove_holes(struct vm_map *map) return; (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(PROT_NONE, PROT_NONE, UVM_INH_SHARE, + UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c index a2e3e6f1e8a..02a8e853a7d 100644 --- a/sys/dev/isa/aha.c +++ b/sys/dev/isa/aha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha.c,v 1.78 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: aha.c,v 1.79 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */ #undef AHADIAG @@ -1080,7 +1080,7 @@ aha_init(sc) if (uvm_pglistalloc(size, 0, 0xffffff, PAGE_SIZE, 0, &pglist, 1, UVM_PLA_NOWAIT) || uvm_map(kernel_map, &va, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_MASK, PROT_MASK, - UVM_INH_NONE, POSIX_MADV_RANDOM, 0))) + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0))) panic("aha_init: could not allocate mailbox"); wmbx = (struct aha_mbx *)va; diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c index 64d9f0f0ca7..29c2f318c9e 100644 --- a/sys/dev/pci/drm/i915/i915_gem.c +++ b/sys/dev/pci/drm/i915/i915_gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem.c,v 1.76 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: i915_gem.c,v 1.77 2014/12/15 02:24:23 guenther Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -1451,7 +1451,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, addr = 0; ret = -uvm_map(&curproc->p_vmspace->vm_map, &addr, size, obj->uao, args->offset, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_SHARE, POSIX_MADV_RANDOM, 0)); + PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)); if (ret == 0) uao_reference(obj->uao); drm_gem_object_unreference_unlocked(obj); diff --git a/sys/dev/pci/drm/i915/intel_ringbuffer.c b/sys/dev/pci/drm/i915/intel_ringbuffer.c index 4ca0ea6f64b..614cf25fa6f 100644 --- a/sys/dev/pci/drm/i915/intel_ringbuffer.c +++ b/sys/dev/pci/drm/i915/intel_ringbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ringbuffer.c,v 1.21 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: intel_ringbuffer.c,v 1.22 2014/12/15 02:24:23 guenther Exp $ */ /* * Copyright © 2008-2010 Intel Corporation * @@ -476,7 +476,7 @@ init_pipe_control(struct intel_ring_buffer *ring) obj->base.uao->pgops->pgo_reference(obj->base.uao); ret = uvm_map(kernel_map, (vaddr_t *)&pc->cpu_page, PAGE_SIZE, obj->base.uao, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_SHARE, POSIX_MADV_RANDOM, 0)); + PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)); if (ret != 0) { DRM_ERROR("Failed to map status page.\n"); obj->base.uao->pgops->pgo_detach(obj->base.uao); @@ -1123,7 +1123,7 @@ static int init_status_page(struct intel_ring_buffer *ring) obj->base.uao->pgops->pgo_reference(obj->base.uao); ret = uvm_map(kernel_map, (vaddr_t *)&ring->status_page.page_addr, PAGE_SIZE, obj->base.uao, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_SHARE, POSIX_MADV_RANDOM, 0)); + PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)); if (ret != 0) { obj->base.uao->pgops->pgo_detach(obj->base.uao); ret = -ENOMEM; diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c index 0a9621b7a9e..c392a00097a 100644 --- a/sys/kern/exec_subr.c +++ b/sys/kern/exec_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_subr.c,v 1.43 2014/12/10 02:44:46 tedu Exp $ */ +/* $OpenBSD: exec_subr.c,v 1.44 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */ /* @@ -194,7 +194,7 @@ vmcmd_map_pagedvn(struct proc *p, struct exec_vmcmd *cmd) error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len, uobj, cmd->ev_offset, 0, - UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, UVM_INH_COPY, + UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, MAP_INHERIT_COPY, POSIX_MADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED)); /* @@ -232,7 +232,7 @@ vmcmd_map_readvn(struct proc *p, struct exec_vmcmd *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, 0, - UVM_MAPFLAG(prot | PROT_WRITE, PROT_MASK, UVM_INH_COPY, + UVM_MAPFLAG(prot | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY, POSIX_MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); @@ -274,7 +274,7 @@ vmcmd_map_zero(struct proc *p, struct exec_vmcmd *cmd) cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */ return (uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, UVM_INH_COPY, + UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, MAP_INHERIT_COPY, POSIX_MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW))); } diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index d8ac5c6dd08..a4c8e69345b 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.226 2014/12/10 02:44:46 tedu Exp $ */ +/* $OpenBSD: init_main.c,v 1.227 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -635,7 +635,7 @@ start_init(void *arg) #endif if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, UVM_INH_COPY, + UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY, POSIX_MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))) panic("init: couldn't allocate argument space"); p->p_vmspace->vm_maxsaddr = (caddr_t)addr; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index ae79aae943c..461bdec341a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.150 2014/12/10 02:44:46 tedu Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.151 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -834,7 +834,7 @@ exec_sigcode_map(struct process *pr, struct emul *e) if ((r = uvm_map(kernel_map, &va, round_page(sz), e->e_sigobject, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_SHARE, POSIX_MADV_RANDOM, 0)))) { + MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)))) { uao_detach(e->e_sigobject); return (ENOMEM); } @@ -846,7 +846,7 @@ exec_sigcode_map(struct process *pr, struct emul *e) uao_reference(e->e_sigobject); if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_sigcode, round_page(sz), e->e_sigobject, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_EXEC, - PROT_READ | PROT_EXEC, UVM_INH_SHARE, POSIX_MADV_RANDOM, 0))) { + PROT_READ | PROT_EXEC, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0))) { uao_detach(e->e_sigobject); return (ENOMEM); } diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 81b4f35cedf..b6dfaa75041 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.61 2014/12/10 02:44:47 tedu Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.62 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -267,7 +267,7 @@ sys_shmat(struct proc *p, void *v, register_t *retval) uao_reference(shm_handle->shm_object); error = uvm_map(&p->p_vmspace->vm_map, &attach_va, size, shm_handle->shm_object, 0, 0, UVM_MAPFLAG(prot, prot, - UVM_INH_SHARE, POSIX_MADV_RANDOM, 0)); + MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)); if (error) { uao_detach(shm_handle->shm_object); return (error); diff --git a/sys/kern/vfs_biomem.c b/sys/kern/vfs_biomem.c index c822cfb7ca7..d1dfacf1401 100644 --- a/sys/kern/vfs_biomem.c +++ b/sys/kern/vfs_biomem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_biomem.c,v 1.31 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: vfs_biomem.c,v 1.32 2014/12/15 02:24:23 guenther Exp $ */ /* * Copyright (c) 2007 Artur Grabowski @@ -54,7 +54,7 @@ buf_mem_init(vsize_t size) buf_kva_start = vm_map_min(kernel_map); if (uvm_map(kernel_map, &buf_kva_start, size, NULL, UVM_UNKNOWN_OFFSET, PAGE_SIZE, UVM_MAPFLAG(PROT_NONE, - PROT_NONE, UVM_INH_NONE, POSIX_MADV_NORMAL, 0))) + PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_NORMAL, 0))) panic("bufinit: can't reserve VM for buffers"); buf_kva_end = buf_kva_start + size; diff --git a/sys/tmpfs/tmpfs_subr.c b/sys/tmpfs/tmpfs_subr.c index baf119f5695..bb42fffd93a 100644 --- a/sys/tmpfs/tmpfs_subr.c +++ b/sys/tmpfs/tmpfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpfs_subr.c,v 1.9 2014/12/04 08:19:03 dcoppa Exp $ */ +/* $OpenBSD: tmpfs_subr.c,v 1.10 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */ /* @@ -1243,7 +1243,7 @@ tmpfs_uiomove(tmpfs_node_t *node, struct uio *uio, vsize_t len) error = uvm_map(kernel_map, &va, round_page(pgoff + sz), node->tn_uobj, trunc_page(uio->uio_offset), 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_NONE, adv, 0)); + PROT_READ | PROT_WRITE, MAP_INHERIT_NONE, adv, 0)); if (error) { uao_detach(node->tn_uobj); /* Drop reference. */ return error; @@ -1270,7 +1270,7 @@ tmpfs_zeropg(tmpfs_node_t *node, voff_t pgnum, vaddr_t pgoff) error = uvm_map(kernel_map, &va, PAGE_SIZE, node->tn_uobj, pgnum, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_NORMAL, 0)); + MAP_INHERIT_NONE, POSIX_MADV_NORMAL, 0)); if (error) { uao_detach(node->tn_uobj); /* Drop reference. */ return error; diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 8656b4cdad4..75fe80365b8 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.125 2014/12/05 04:12:48 uebayasi Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.126 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -80,24 +80,29 @@ typedef struct vm_map *vm_map_t; struct vm_page; typedef struct vm_page *vm_page_t; +/* + * Bit assignments assigned by UVM_MAPFLAG() and extracted by + * UVM_{PROTECTION,INHERIT,MAXPROTECTION,ADVICE}(): + * bits 0-2 protection + * bit 3 unused + * bits 4-5 inheritance + * bits 6-7 unused + * bits 8-10 max protection + * bit 11 unused + * bits 12-14 advice + * bit 15 unused + * bits 16-N flags + */ + /* protections bits */ #define PROT_MASK (PROT_READ | PROT_WRITE | PROT_EXEC) -/* 0x08: not used */ /* inherit codes */ -#define UVM_INH_MASK 0x30 /* inherit mask */ -#define UVM_INH_SHARE 0x00 /* "share" */ -#define UVM_INH_COPY 0x10 /* "copy" */ -#define UVM_INH_NONE 0x20 /* "none" */ -#define UVM_INH_ZERO 0x30 /* "zero" */ - -/* 0x40, 0x80: not used */ -/* bits 0x700: max protection, 0x800: not used */ -/* bits 0x7000: advice, 0x8000: not used */ +#define MAP_INHERIT_MASK 0x3 /* inherit mask */ typedef int vm_prot_t; -#define UVM_ADV_MASK 0x7 /* mask */ +#define MADV_MASK 0x7 /* mask */ /* mapping flags */ #define UVM_FLAG_FIXED 0x0010000 /* find space */ @@ -112,12 +117,12 @@ typedef int vm_prot_t; /* macros to extract info */ #define UVM_PROTECTION(X) ((X) & PROT_MASK) -#define UVM_INHERIT(X) (((X) & UVM_INH_MASK) >> 4) +#define UVM_INHERIT(X) (((X) >> 4) & MAP_INHERIT_MASK) #define UVM_MAXPROTECTION(X) (((X) >> 8) & PROT_MASK) -#define UVM_ADVICE(X) (((X) >> 12) & UVM_ADV_MASK) +#define UVM_ADVICE(X) (((X) >> 12) & MADV_MASK) #define UVM_MAPFLAG(prot, maxprot, inh, advice, flags) \ - (((maxprot) << 8) | (prot) | (inh) | ((advice) << 12) | (flags)) + ((prot) | ((maxprot) << 8) | ((inh) << 4) | ((advice) << 12) | (flags)) /* magic offset value */ #define UVM_UNKNOWN_OFFSET ((voff_t) -1) diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index 4c7cf86f945..fb6179393c1 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.c,v 1.79 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: uvm_fault.c,v 1.80 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */ /* @@ -151,7 +151,7 @@ struct uvm_advice { /* * page range array: set up in uvmfault_init(). */ -static struct uvm_advice uvmadvice[UVM_ADV_MASK + 1]; +static struct uvm_advice uvmadvice[MADV_MASK + 1]; #define UVM_MAXRANGE 16 /* must be max() of nback+nforw+1 */ diff --git a/sys/uvm/uvm_init.c b/sys/uvm/uvm_init.c index b6120802173..6efe21078e8 100644 --- a/sys/uvm/uvm_init.c +++ b/sys/uvm/uvm_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_init.c,v 1.35 2014/11/16 12:31:00 deraadt Exp $ */ +/* $OpenBSD: uvm_init.c,v 1.36 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $ */ /* @@ -148,14 +148,14 @@ uvm_init(void) kvm_start = trunc_page(DEADBEEF0) - PAGE_SIZE; if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE, - PROT_NONE, UVM_INH_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED))) + PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED))) panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF0); #endif #ifdef DEADBEEF1 kvm_start = trunc_page(DEADBEEF1) - PAGE_SIZE; if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE, - PROT_NONE, UVM_INH_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED))) + PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED))) panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF1); #endif /* diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index d0f21231d5c..53ddeef501c 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.121 2014/11/27 21:40:52 kettenis Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.122 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -184,7 +184,7 @@ uvm_km_init(vaddr_t start, vaddr_t end) if (base != start && uvm_map(&kernel_map_store, &base, start - base, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)) != 0) + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)) != 0) panic("uvm_km_init: could not reserve space for kernel"); kernel_map = &kernel_map_store; @@ -211,7 +211,7 @@ uvm_km_suballoc(struct vm_map *map, vaddr_t *min, vaddr_t *max, vsize_t size, /* first allocate a blank spot in the parent map */ if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_NONE, + PROT_READ | PROT_WRITE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, mapflags)) != 0) { panic("uvm_km_suballoc: unable to allocate space in parent map"); } @@ -341,7 +341,7 @@ uvm_km_kmemalloc_pla(struct vm_map *map, struct uvm_object *obj, vsize_t size, /* allocate some virtual space */ if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET, valign, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_NONE, + PROT_READ | PROT_WRITE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != 0)) { return(0); } @@ -460,7 +460,7 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit) UVM_UNKNOWN_OFFSET, align, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE | PROT_EXEC, - UVM_INH_NONE, POSIX_MADV_RANDOM, 0)) != 0)) { + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) != 0)) { return(0); } @@ -548,7 +548,7 @@ uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align, int flags) if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object, UVM_UNKNOWN_OFFSET, align, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_RANDOM, flags)) != 0)) { + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, flags)) != 0)) { return(0); } @@ -583,7 +583,7 @@ uvm_km_valloc_prefer_wait(struct vm_map *map, vsize_t size, voff_t prefer) if (__predict_true(uvm_map(map, &kva, size, uvm.kernel_object, prefer, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_RANDOM, 0)) == 0)) { + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) == 0)) { return(kva); } @@ -667,7 +667,7 @@ uvm_km_page_init(void) if (uvm_map(kernel_map, &addr, (vsize_t)bulk << PAGE_SHIFT, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE, UVM_INH_NONE, + PROT_READ | PROT_WRITE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_KMF_TRYLOCK)) != 0) { bulk /= 2; continue; @@ -732,7 +732,7 @@ uvm_km_thread(void *arg) */ flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_RANDOM, + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, fp != NULL ? UVM_KMF_TRYLOCK : 0); memset(pg, 0, sizeof(pg)); for (i = 0; i < nitems(pg); i++) { @@ -746,7 +746,7 @@ uvm_km_thread(void *arg) /* made progress, so don't sleep for more */ flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, - UVM_INH_NONE, POSIX_MADV_RANDOM, + MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_KMF_TRYLOCK); } @@ -920,7 +920,7 @@ try_map: map = *kv->kv_map; va = vm_map_min(map); if (uvm_map(map, &va, sz, uobj, kd->kd_prefer, - kv->kv_align, UVM_MAPFLAG(prot, prot, UVM_INH_NONE, + kv->kv_align, UVM_MAPFLAG(prot, prot, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, mapflags))) { if (kv->kv_wait && kd->kd_waitok) { tsleep(map, PVM, "km_allocva", 0); diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 10e92411f0b..860cb79bba0 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.101 2014/12/09 07:16:41 doug Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.102 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -892,8 +892,7 @@ sys_munlockall(struct proc *p, void *v, register_t *retval) * uvm_mmap: internal version of mmap * * - used by sys_mmap, exec, and sysv shm - * - handle is a vnode pointer or NULL for MAP_ANON (XXX: not true, - * sysv shm uses "named anonymous memory") + * - handle is a vnode pointer or ignored for MAP_ANON * - caller must page-align the file offset */ int @@ -1010,8 +1009,8 @@ uvm_mmap(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot, /* set up mapping flags */ uvmflag = UVM_MAPFLAG(prot, maxprot, - (flags & MAP_SHARED) ? UVM_INH_SHARE : UVM_INH_COPY, - advice, uvmflag); + (flags & MAP_SHARED) ? MAP_INHERIT_SHARE : MAP_INHERIT_COPY, + advice, uvmflag); error = uvm_map(map, addr, size, uobj, foff, align, uvmflag); diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 424ab04e1db..4e28942df14 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.52 2014/11/17 03:15:58 deraadt Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.53 2014/12/15 02:24:23 guenther Exp $ */ /* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* @@ -86,7 +86,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval) error = uvm_map(&vm->vm_map, &old, new - old, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE | PROT_EXEC, UVM_INH_COPY, + PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY, POSIX_MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); if (error) {