diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-11-16 12:31:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-11-16 12:31:02 +0000 |
commit | 84110ac1ecd0b90236884f584c62f0aba5630fc2 (patch) | |
tree | fad09b733c1e1122314b073b82f6d36a1024e050 /sys/arch/vax | |
parent | cbbf1bf46622bbdb478ef4df4e4e027e0b83fc62 (diff) |
Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/vax/bus_dma.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/vax/pmap.c | 32 | ||||
-rw-r--r-- | sys/arch/vax/vax/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/vax/vm_machdep.c | 5 |
4 files changed, 26 insertions, 25 deletions
diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c index 76f8c39873c..e6519b5d9d4 100644 --- a/sys/arch/vax/vax/bus_dma.c +++ b/sys/arch/vax/vax/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.30 2014/09/13 16:06:37 doug Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.31 2014/11/16 12:30:59 deraadt Exp $ */ /* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */ /*- @@ -444,7 +444,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (vax_boardtype == VAX_BTYP_43) { pmap_map((vaddr_t)*kvap, segs[0].ds_addr|KA43_DIAGMEM, (segs[0].ds_addr|KA43_DIAGMEM) + size, - VM_PROT_READ|VM_PROT_WRITE); + PROT_READ | PROT_WRITE); } return 0; } @@ -467,8 +467,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (vax_boardtype == VAX_BTYP_43) addr |= KA43_DIAGMEM; error = pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | - VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); + PROT_READ | PROT_WRITE, + PROT_READ | PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); km_free((void *)sva, ssize, &kv_any, &kp_none); diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 4eb3160b1ce..bb9ceaa4323 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.69 2014/05/24 20:13:52 guenther Exp $ */ +/* $OpenBSD: pmap.c,v 1.70 2014/11/16 12:30:59 deraadt 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. @@ -283,7 +283,7 @@ pmap_bootstrap() * memory mapped in. This makes some mm routines both simpler * and faster, but takes ~0.75% more memory. */ - pmap_map(KERNBASE, 0, avail_end, VM_PROT_READ|VM_PROT_WRITE); + pmap_map(KERNBASE, 0, avail_end, PROT_READ | PROT_WRITE); /* * Kernel code is always readable for user, it must be because * of the emulation code that is somewhere in there. @@ -860,7 +860,7 @@ pmap_remove_holes(struct vm_map *map) return; (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_SHARE, + UVM_MAPFLAG(PROT_NONE, PROT_NONE, UVM_INH_SHARE, UVM_ADV_RANDOM, UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED)); } @@ -969,7 +969,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) pmap_kernel()->pm_stats.resident_count++; pmap_kernel()->pm_stats.wired_count++; } - mapin8(ptp, PG_V | ((prot & VM_PROT_WRITE) ? PG_KW : PG_KR) | + mapin8(ptp, PG_V | ((prot & PROT_WRITE) ? PG_KW : PG_KR) | PG_PFNUM(pa) | PG_W | PG_SREF); if (opte & PG_V) { mtpr(0, PR_TBIA); @@ -1038,7 +1038,7 @@ pmap_enter(struct pmap *pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags) switch (SEGTYPE(v)) { case SYSSEG: pteptr = Sysmap + vax_btop(v - KERNBASE); - newpte = prot & VM_PROT_WRITE ? PG_KW : PG_KR; + newpte = prot & PROT_WRITE ? PG_KW : PG_KR; break; case P0SEG: pteidx = vax_btop(v); @@ -1047,7 +1047,7 @@ pmap_enter(struct pmap *pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags) return ENOMEM; } pteptr = pmap->pm_p0br + pteidx; - newpte = prot & VM_PROT_WRITE ? PG_RW : PG_RO; + newpte = prot & PROT_WRITE ? PG_RW : PG_RO; break; case P1SEG: pteidx = vax_btop(v - 0x40000000); @@ -1056,7 +1056,7 @@ pmap_enter(struct pmap *pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags) return ENOMEM; } pteptr = pmap->pm_p1br + pteidx; - newpte = prot & VM_PROT_WRITE ? PG_RW : PG_RO; + newpte = prot & PROT_WRITE ? PG_RW : PG_RO; break; default: panic("bad seg"); @@ -1152,11 +1152,11 @@ pmap_enter(struct pmap *pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags) pmap->pm_stats.wired_count++; } - if (flags & VM_PROT_READ) { + if (flags & PROT_READ) { pg->mdpage.pv_attr |= PG_V; newpte |= PG_V; } - if (flags & VM_PROT_WRITE) + if (flags & PROT_WRITE) pg->mdpage.pv_attr |= PG_M; if (flags & PMAP_WIRED) @@ -1184,7 +1184,7 @@ pmap_map(vaddr_t va, paddr_t pstart, paddr_t pend, int prot) pentry = Sysmap + vax_btop(va); for (count = pstart; count < pend; count += VAX_NBPG) { *pentry++ = vax_btop(count) | PG_V | - (prot & VM_PROT_WRITE ? PG_KW : PG_KR); + (prot & PROT_WRITE ? PG_KW : PG_KR); } return va + (count - pstart) + KERNBASE; } @@ -1257,7 +1257,7 @@ pmap_protect(struct pmap *pmap, vaddr_t start, vaddr_t end, vm_prot_t prot) #endif start &= ~KERNBASE; end &= ~KERNBASE; - pr = (prot & VM_PROT_WRITE ? PG_KW : PG_KR); + pr = (prot & PROT_WRITE ? PG_KW : PG_KR); break; case P1SEG: @@ -1270,7 +1270,7 @@ pmap_protect(struct pmap *pmap, vaddr_t start, vaddr_t end, vm_prot_t prot) pt = pmap->pm_p1br; start &= 0x3fffffff; end = (end == KERNBASE ? 0x40000000 : end & 0x3fffffff); - pr = (prot & VM_PROT_WRITE ? PG_RW : PG_RO); + pr = (prot & PROT_WRITE ? PG_RW : PG_RO); break; case P0SEG: @@ -1284,7 +1284,7 @@ pmap_protect(struct pmap *pmap, vaddr_t start, vaddr_t end, vm_prot_t prot) if (vax_btop(end) > lr) end = lr * VAX_NBPG; pt = pmap->pm_p0br; - pr = (prot & VM_PROT_WRITE ? PG_RW : PG_RO); + pr = (prot & PROT_WRITE ? PG_RW : PG_RO); break; default: panic("unsupported segtype: %d", (int)SEGTYPE(start)); @@ -1301,7 +1301,7 @@ pmap_protect(struct pmap *pmap, vaddr_t start, vaddr_t end, vm_prot_t prot) while (pts < ptd) { if ((*kvtopte((vaddr_t)pts) & PG_FRAME) != 0 && *pts != PG_NV) { - if (prot == VM_PROT_NONE) { + if (prot == PROT_NONE) { pmap->pm_stats.resident_count--; if ((*pts & PG_W)) pmap->pm_stats.wired_count--; @@ -1519,11 +1519,11 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot) if (pg->mdpage.pv_head == NULL) return; - if (prot == VM_PROT_ALL) /* 'cannot happen' */ + if (prot == PROT_MASK) /* 'cannot happen' */ return; RECURSESTART; - if (prot == VM_PROT_NONE) { + if (prot == PROT_NONE) { s = splvm(); npv = pg->mdpage.pv_head; pg->mdpage.pv_head = NULL; diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c index bc6f28b2f89..7260b4ec777 100644 --- a/sys/arch/vax/vax/trap.c +++ b/sys/arch/vax/vax/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.53 2014/05/11 00:12:44 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.54 2014/11/16 12:30:59 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -187,9 +187,9 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n", map = &p->p_vmspace->vm_map; if (frame->trap & T_WRITE) - ftype = VM_PROT_WRITE|VM_PROT_READ; + ftype = PROT_READ | PROT_WRITE; else - ftype = VM_PROT_READ; + ftype = PROT_READ; addr = trunc_page((vaddr_t)frame->code); rv = uvm_fault(map, addr, 0, ftype); diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index 851b05c3a9e..7ab91cfa425 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.41 2013/11/24 22:08:25 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.42 2014/11/16 12:30:59 deraadt Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -291,7 +291,8 @@ vmapbuf(bp, len) &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa), - VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); + PROT_READ | PROT_WRITE, + PROT_READ | PROT_WRITE | PMAP_WIRED); faddr += PAGE_SIZE; taddr += PAGE_SIZE; } |