1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

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
This commit is contained in:
deraadt 2014-11-16 12:30:52 +00:00
parent 1d818b7b52
commit 1e8cdc2e59
167 changed files with 1024 additions and 1074 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: pmap.9,v 1.13 2014/07/13 23:03:03 schwarze Exp $
.\" $OpenBSD: pmap.9,v 1.14 2014/11/16 12:31:01 deraadt Exp $
.\"
.\" Copyright (c) 2001, 2002, 2003 CubeSoft Communications, Inc.
.\" <http://www.csoft.org>
@ -24,7 +24,7 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2014 $
.Dd $Mdocdate: November 16 2014 $
.Dt PMAP 9
.Os
.Sh NAME
@ -120,12 +120,12 @@ in the target physical map
.Fa pmap
with protection specified by
.Fa prot :
.Bl -tag -width "VM_PROT_EXECUTE"
.It VM_PROT_READ
.Bl -tag -width "PROT_WRITE"
.It PROT_READ
The mapping must allow reading.
.It VM_PROT_WRITE
.It PROT_WRITE
The mapping must allow writing.
.It VM_PROT_EXECUTE
.It PROT_EXEC
The page mapped contains instructions that will be executed by the
processor.
.El

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: uvm.9,v 1.58 2014/07/03 06:55:59 matthew Exp $
.\" $OpenBSD: uvm.9,v 1.59 2014/11/16 12:31:01 deraadt Exp $
.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $
.\"
.\" Copyright (c) 1998 Matthew R. Green
@ -30,7 +30,7 @@
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain
.\" synopsis-like function prototypes. any better way?
.\"
.Dd $Mdocdate: July 3 2014 $
.Dd $Mdocdate: November 16 2014 $
.Dt UVM 9
.Os
.Sh NAME
@ -213,21 +213,13 @@ The
.Fa prot
and
.Fa maxprot
can take the following values:
can take a mix of the following values:
.Bd -literal
#define UVM_PROT_MASK 0x07 /* protection mask */
#define UVM_PROT_NONE 0x00 /* protection none */
#define UVM_PROT_ALL 0x07 /* everything */
#define UVM_PROT_READ 0x01 /* read */
#define UVM_PROT_WRITE 0x02 /* write */
#define UVM_PROT_EXEC 0x04 /* exec */
#define UVM_PROT_R 0x01 /* read */
#define UVM_PROT_W 0x02 /* write */
#define UVM_PROT_RW 0x03 /* read-write */
#define UVM_PROT_X 0x04 /* exec */
#define UVM_PROT_RX 0x05 /* read-exec */
#define UVM_PROT_WX 0x06 /* write-exec */
#define UVM_PROT_RWX 0x07 /* read-write-exec */
#define PROT_MASK 0x07 /* protection mask */
#define PROT_NONE 0x00 /* protection none */
#define PROT_READ 0x01 /* read */
#define PROT_WRITE 0x02 /* write */
#define PROT_EXEC 0x04 /* exec */
.Ed
.Pp
The values that
@ -267,10 +259,6 @@ can take are:
The
.Dv UVM_MAPFLAG
macro arguments can be combined with an or operator.
There are several special purpose macros for checking protection combinations,
e.g., the
.Dv UVM_PROT_WX
macro.
There are also some additional macros to extract bits from the flags.
The
.Dv UVM_PROTECTION ,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.165 2014/09/20 09:28:24 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.166 2014/11/16 12:30:52 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@ -485,10 +485,10 @@ nobootinfo:
memc->mddt_usage & MDDT_NONVOLATILE || /* XXX */
memc->mddt_usage & MDDT_PALCODE)
mem_clusters[mem_cluster_cnt].size |=
VM_PROT_READ;
PROT_READ;
else
mem_clusters[mem_cluster_cnt].size |=
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
PROT_READ | PROT_WRITE | PROT_EXEC;
mem_cluster_cnt++;
} /* XXX else print something! */
@ -1905,9 +1905,9 @@ alpha_pa_access(pa)
* access. Otherwise, grant read/write.
*/
if (securelevel > 0)
return (VM_PROT_NONE);
return (PROT_NONE);
else
return (VM_PROT_READ | VM_PROT_WRITE);
return (PROT_READ | PROT_WRITE);
}
/* XXX XXX BEGIN XXX XXX */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.72 2014/03/29 18:09:28 guenther Exp $ */
/* $OpenBSD: pmap.c,v 1.73 2014/11/16 12:30:52 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */
/*-
@ -1382,18 +1382,18 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
#ifdef DEBUG
if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
(prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)))
(prot == PROT_NONE && (pmapdebug & PDB_REMOVE)))
printf("pmap_page_protect(%p, %x)\n", pg, prot);
#endif
switch (prot) {
case VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE:
case VM_PROT_READ|VM_PROT_WRITE:
case PROT_READ | PROT_WRITE | PROT_EXEC:
case PROT_READ | PROT_WRITE:
return;
/* copy_on_write */
case VM_PROT_READ|VM_PROT_EXECUTE:
case VM_PROT_READ:
case PROT_READ | PROT_EXEC:
case PROT_READ:
PMAP_HEAD_TO_MAP_LOCK();
for (pv = pg->mdpage.pvh_list; pv != NULL; pv = pv->pv_next) {
PMAP_LOCK(pv->pv_pmap);
@ -1465,7 +1465,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
pmap, sva, eva, prot);
#endif
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
if ((prot & PROT_READ) == PROT_NONE) {
pmap_remove(pmap, sva, eva);
return;
}
@ -1507,7 +1507,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
PMAP_TLB_SHOOTNOW();
if (prot & VM_PROT_EXECUTE)
if (prot & PROT_EXEC)
PMAP_SYNC_ISTREAM(pmap);
PMAP_UNLOCK(pmap);
@ -1554,11 +1554,11 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
/*
* Determine what we need to do about the I-stream. If
* VM_PROT_EXECUTE is set, we mark a user pmap as needing
* PROT_EXEC is set, we mark a user pmap as needing
* an I-sync on the way back out to userspace. We always
* need an immediate I-sync for the kernel pmap.
*/
if (prot & VM_PROT_EXECUTE) {
if (prot & PROT_EXEC) {
if (pmap == pmap_kernel())
needisync = TRUE;
else {
@ -1756,12 +1756,12 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
int attrs;
#ifdef DIAGNOSTIC
if ((flags & VM_PROT_ALL) & ~prot)
if ((flags & PROT_MASK) & ~prot)
panic("pmap_enter: access type exceeds prot");
#endif
if (flags & VM_PROT_WRITE)
if (flags & PROT_WRITE)
pg->mdpage.pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED);
else if (flags & VM_PROT_ALL)
else if (flags & PROT_MASK)
pg->mdpage.pvh_attrs |= PGA_REFERENCED;
attrs = pg->mdpage.pvh_attrs;
@ -1856,7 +1856,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
if (pmap_pte_w(pte) == 0)
PMAP_STAT_DECR(pmap->pm_stats.wired_count, 1);
if ((prot & VM_PROT_EXECUTE) != 0 || pmap_pte_exec(pte))
if ((prot & PROT_EXEC) != 0 || pmap_pte_exec(pte))
needisync = TRUE;
/*
@ -2359,15 +2359,15 @@ alpha_protection_init(void)
kp[prot] = PG_ASM;
up[prot] = 0;
if (prot & VM_PROT_READ) {
if (prot & PROT_READ) {
kp[prot] |= PG_KRE;
up[prot] |= PG_KRE | PG_URE;
}
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
kp[prot] |= PG_KWE;
up[prot] |= PG_KWE | PG_UWE;
}
if (prot & VM_PROT_EXECUTE) {
if (prot & PROT_EXEC) {
kp[prot] |= PG_EXEC | PG_KRE;
up[prot] |= PG_EXEC | PG_KRE | PG_URE;
} else {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.75 2014/07/02 18:37:33 miod Exp $ */
/* $OpenBSD: trap.c,v 1.76 2014/11/16 12:30:52 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@ -375,7 +375,7 @@ trap(a0, a1, a2, entry, framep)
case ALPHA_MMCSR_FOW:
KERNEL_LOCK();
if (pmap_emulate_reference(p, a0, user, a1)) {
ftype = VM_PROT_EXECUTE;
ftype = PROT_EXEC;
goto do_fault;
}
KERNEL_UNLOCK();
@ -392,13 +392,13 @@ trap(a0, a1, a2, entry, framep)
switch (a2) {
case -1: /* instruction fetch fault */
ftype = VM_PROT_EXECUTE;
ftype = PROT_EXEC;
break;
case 0: /* load instruction */
ftype = VM_PROT_READ;
ftype = PROT_READ;
break;
case 1: /* store instruction */
ftype = VM_PROT_READ|VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
break;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.41 2014/02/01 21:19:35 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.42 2014/11/16 12:30:52 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.55 2000/03/29 03:49:48 simonb Exp $ */
/*
@ -262,7 +262,7 @@ vmapbuf(bp, len)
faddr, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa),
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
PROT_READ | PROT_WRITE, PMAP_WIRED);
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.34 2014/09/13 16:06:36 doug Exp $ */
/* $OpenBSD: bus_dma.c,v 1.35 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
/*-
@ -611,8 +611,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
if (size == 0)
panic("_bus_dmamem_map: size botch");
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);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_machdep.c,v 1.63 2014/09/19 20:02:25 kettenis Exp $ */
/* $OpenBSD: acpi_machdep.c,v 1.64 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@ -82,7 +82,7 @@ acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle)
handle->pa = pa;
do {
pmap_kenter_pa(va, pgpa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pgpa, PROT_READ | PROT_WRITE);
va += NBPG;
pgpa += NBPG;
} while (pgpa < endpa);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bios.c,v 1.28 2014/09/14 14:17:23 jsg Exp $ */
/* $OpenBSD: bios.c,v 1.29 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
*
@ -133,7 +133,7 @@ bios_attach(struct device *parent, struct device *self, void *aux)
smbios_entry.count = hdr->count;
for (; pa < end; pa+= NBPG, va+= NBPG)
pmap_kenter_pa(va, pa, VM_PROT_READ);
pmap_kenter_pa(va, pa, PROT_READ);
printf(": SMBIOS rev. %d.%d @ 0x%x (%d entries)",
hdr->majrev, hdr->minrev, hdr->addr, hdr->count);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.45 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: bus_dma.c,v 1.46 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@ -494,8 +494,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
if (size == 0)
panic("_bus_dmamem_map: size botch");
error = pmap_enter(pmap_kernel(), va, addr | pmapflags,
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);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_space.c,v 1.24 2014/10/25 16:57:58 kettenis Exp $ */
/* $OpenBSD: bus_space.c,v 1.25 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: bus_space.c,v 1.2 2003/03/14 18:47:53 christos Exp $ */
/*-
@ -508,8 +508,7 @@ x86_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
for (; map_size > 0;
pa += PAGE_SIZE, va += PAGE_SIZE, map_size -= PAGE_SIZE)
pmap_kenter_pa(va, pa | pmap_flags,
VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa | pmap_flags, PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
return 0;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.66 2014/10/09 03:59:58 tedu Exp $ */
/* $OpenBSD: cpu.c,v 1.67 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@ -170,9 +170,8 @@ replacesmap(void)
pmap_extract(pmap_kernel(), kva, &pa1);
pmap_extract(pmap_kernel(), kva + PAGE_SIZE, &pa2);
pmap_kenter_pa(nva, pa1, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(nva + PAGE_SIZE, pa2, VM_PROT_READ |
VM_PROT_WRITE);
pmap_kenter_pa(nva, pa1, PROT_READ | PROT_WRITE);
pmap_kenter_pa(nva + PAGE_SIZE, pa2, PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
/* replace 3 byte nops with stac/clac instructions */
@ -833,7 +832,7 @@ mp_cpu_start(struct cpu_info *ci)
dwordptr[0] = 0;
dwordptr[1] = MP_TRAMPOLINE >> 4;
pmap_kenter_pa(0, 0, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(0, 0, PROT_READ | PROT_WRITE);
memcpy((u_int8_t *) 0x467, dwordptr, 4);
pmap_kremove(0, PAGE_SIZE);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gdt.c,v 1.20 2014/09/14 14:17:23 jsg Exp $ */
/* $OpenBSD: gdt.c,v 1.21 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: gdt.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@ -65,8 +65,7 @@ gdt_alloc_cpu(struct cpu_info *ci)
pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
if (pg == NULL)
panic("gdt_init: no pages");
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg), PROT_READ | PROT_WRITE);
}
bcopy(gdtstore, ci->ci_gdt, GDT_SIZE);
bzero(ci->ci_tss, sizeof(*ci->ci_tss));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: hibernate_machdep.c,v 1.30 2014/11/08 08:18:37 mlarkin Exp $ */
/* $OpenBSD: hibernate_machdep.c,v 1.31 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
@ -272,22 +272,22 @@ hibernate_populate_resume_pt(union hibernate_info *hib_info,
pt_entry_t *pde, npde;
/* Identity map MMU pages */
pmap_kenter_pa(HIBERNATE_PML4T, HIBERNATE_PML4T, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PDPT_LOW, HIBERNATE_PDPT_LOW, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PDPT_HI, HIBERNATE_PDPT_HI, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PD_LOW, HIBERNATE_PD_LOW, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PD_LOW2, HIBERNATE_PD_LOW2, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PD_HI, HIBERNATE_PD_HI, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PT_LOW, HIBERNATE_PT_LOW, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PT_LOW2, HIBERNATE_PT_LOW2, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PT_HI, HIBERNATE_PT_HI, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PML4T, HIBERNATE_PML4T, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PDPT_LOW, HIBERNATE_PDPT_LOW, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PDPT_HI, HIBERNATE_PDPT_HI, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PD_LOW, HIBERNATE_PD_LOW, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PD_LOW2, HIBERNATE_PD_LOW2, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PD_HI, HIBERNATE_PD_HI, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PT_LOW, HIBERNATE_PT_LOW, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PT_LOW2, HIBERNATE_PT_LOW2, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PT_HI, HIBERNATE_PT_HI, PROT_MASK);
/* Identity map 3 pages for stack */
pmap_kenter_pa(HIBERNATE_STACK_PAGE, HIBERNATE_STACK_PAGE, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_STACK_PAGE, HIBERNATE_STACK_PAGE, PROT_MASK);
pmap_kenter_pa(HIBERNATE_STACK_PAGE - PAGE_SIZE,
HIBERNATE_STACK_PAGE - PAGE_SIZE, VM_PROT_ALL);
HIBERNATE_STACK_PAGE - PAGE_SIZE, PROT_MASK);
pmap_kenter_pa(HIBERNATE_STACK_PAGE - 2*PAGE_SIZE,
HIBERNATE_STACK_PAGE - 2*PAGE_SIZE, VM_PROT_ALL);
HIBERNATE_STACK_PAGE - 2*PAGE_SIZE, PROT_MASK);
pmap_activate(curproc);
bzero((caddr_t)HIBERNATE_PML4T, PAGE_SIZE);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.194 2014/11/08 03:31:58 guenther Exp $ */
/* $OpenBSD: machdep.c,v 1.195 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@ -1179,7 +1179,7 @@ void
map_tramps(void) {
struct pmap *kmp = pmap_kernel();
pmap_kenter_pa(lo32_vaddr, lo32_paddr, VM_PROT_ALL);
pmap_kenter_pa(lo32_vaddr, lo32_paddr, PROT_READ | PROT_WRITE | PROT_EXEC);
/*
* The initial PML4 pointer must be below 4G, so if the
@ -1195,12 +1195,12 @@ map_tramps(void) {
#ifdef MULTIPROCESSOR
pmap_kenter_pa((vaddr_t)MP_TRAMPOLINE, /* virtual */
(paddr_t)MP_TRAMPOLINE, /* physical */
VM_PROT_ALL); /* protection */
PROT_MASK); /* protection */
#endif /* MULTIPROCESSOR */
pmap_kenter_pa((vaddr_t)ACPI_TRAMPOLINE, /* virtual */
(paddr_t)ACPI_TRAMPOLINE, /* physical */
VM_PROT_ALL); /* protection */
PROT_MASK); /* protection */
}
#endif
@ -1507,9 +1507,9 @@ init_x86_64(paddr_t first_avail)
pmap_growkernel(VM_MIN_KERNEL_ADDRESS + 32 * 1024 * 1024);
pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(idt_vaddr, idt_paddr, PROT_READ | PROT_WRITE);
pmap_kenter_pa(idt_vaddr + PAGE_SIZE, idt_paddr + PAGE_SIZE,
VM_PROT_READ|VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
#if defined(MULTIPROCESSOR) || \
(NACPI > 0 && !defined(SMALL_KERNEL))

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mpbios.c,v 1.22 2014/05/26 19:03:28 kettenis Exp $ */
/* $OpenBSD: mpbios.c,v 1.23 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */
/*-
@ -259,7 +259,7 @@ mpbios_map(paddr_t pa, int len, struct mp_map *handle)
handle->vsize = endpa - pgpa;
do {
pmap_kenter_pa(va, pgpa, VM_PROT_READ);
pmap_kenter_pa(va, pgpa, PROT_READ);
va += PAGE_SIZE;
pgpa += PAGE_SIZE;
} while (pgpa < endpa);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.77 2014/11/07 03:20:02 mlarkin Exp $ */
/* $OpenBSD: pmap.c,v 1.78 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
@ -296,7 +296,7 @@ static const struct nx_range_description nx_ranges[] = {
/*
* List of ranges to map as NX (non-execute) if the processor supports
* NX. Each range consists of a start vaddr and size (in bytes), and a
* protection value (eg, VM_PROT_READ or VM_PROT_READ | VM_PROT_WRITE).
* protection value (eg, PROT_READ or PROT_READ | PROT_WRITE).
*
* The list also includes an 'is_ptr' field in each element to denote
* if the 'start' value is a constant (is_ptr == 0) or should be
@ -308,13 +308,13 @@ static const struct nx_range_description nx_ranges[] = {
{ /* .rodata range */
(vaddr_t)&__rodata_start,
(size_t)&__rodata_size,
VM_PROT_READ,
PROT_READ,
0
},
{ /* ISA hole */
(vaddr_t)&atdevbase,
IOM_SIZE,
VM_PROT_READ | VM_PROT_WRITE,
PROT_READ | PROT_WRITE,
1
}
};
@ -493,7 +493,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
pte = kvtopte(va);
npte = (pa & PMAP_PA_MASK) | ((prot & VM_PROT_WRITE) ? PG_RW : PG_RO) |
npte = (pa & PMAP_PA_MASK) | ((prot & PROT_WRITE) ? PG_RW : PG_RO) |
((pa & PMAP_NOCACHE) ? PG_N : 0) |
((pa & PMAP_WC) ? pmap_pg_wc : 0) | PG_V;
@ -501,7 +501,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
if (va >= (vaddr_t)NBPD_L2)
npte |= PG_G;
if ((cpu_feature & CPUID_NXE) && !(prot & VM_PROT_EXECUTE))
if ((cpu_feature & CPUID_NXE) && !(prot & PROT_EXEC))
npte |= PG_NX;
opte = pmap_pte_set(pte, npte);
#ifdef LARGEPAGES
@ -593,15 +593,14 @@ pmap_bootstrap(paddr_t first_avail, paddr_t max_pa)
* we can jam into a i386 PTE.
*/
protection_codes[VM_PROT_NONE] = pg_nx; /* --- */
protection_codes[VM_PROT_EXECUTE] = PG_RO; /* --x */
protection_codes[VM_PROT_READ] = PG_RO | pg_nx; /* -r- */
protection_codes[VM_PROT_READ|VM_PROT_EXECUTE] = PG_RO; /* -rx */
protection_codes[VM_PROT_WRITE] = PG_RW | pg_nx; /* w-- */
protection_codes[VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW;/* w-x */
protection_codes[VM_PROT_WRITE|VM_PROT_READ] = PG_RW | pg_nx;
/* wr- */
protection_codes[VM_PROT_ALL] = PG_RW; /* wrx */
protection_codes[PROT_NONE] = pg_nx; /* --- */
protection_codes[PROT_EXEC] = PG_RO; /* --x */
protection_codes[PROT_READ] = PG_RO | pg_nx; /* -r- */
protection_codes[PROT_READ | PROT_EXEC] = PG_RO; /* -rx */
protection_codes[PROT_WRITE] = PG_RW | pg_nx; /* w-- */
protection_codes[PROT_WRITE | PROT_EXEC] = PG_RW; /* w-x */
protection_codes[PROT_WRITE | PROT_READ] = PG_RW | pg_nx; /* wr- */
protection_codes[PROT_READ | PROT_WRITE | PROT_EXEC] = PG_RW; /* wrx */
/*
* now we init the kernel's pmap
@ -1850,7 +1849,7 @@ pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
eva &= PG_FRAME;
nx = 0;
if ((cpu_feature & CPUID_NXE) && !(prot & VM_PROT_EXECUTE))
if ((cpu_feature & CPUID_NXE) && !(prot & PROT_EXEC))
nx = PG_NX;
if ((eva - sva > 32 * PAGE_SIZE) && pmap != pmap_kernel())

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.42 2014/07/13 12:11:01 jasper Exp $ */
/* $OpenBSD: trap.c,v 1.43 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@ -353,11 +353,11 @@ faultcommon:
else
map = &vm->vm_map;
if (frame->tf_err & PGEX_W)
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
else if (frame->tf_err & PGEX_I)
ftype = VM_PROT_EXECUTE;
ftype = PROT_EXEC;
else
ftype = VM_PROT_READ;
ftype = PROT_READ;
#ifdef DIAGNOSTIC
if (map == kernel_map && va == 0) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.28 2013/06/02 16:38:05 guenther Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.29 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 2003/04/26 18:39:33 fvdl Exp $ */
/*-
@ -249,7 +249,7 @@ vmapbuf(struct buf *bp, vsize_t len)
while (len) {
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &fpa);
pmap_kenter_pa(taddr, fpa, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(taddr, fpa, PROT_READ | PROT_WRITE);
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
len -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.h,v 1.47 2014/10/06 20:34:58 sf Exp $ */
/* $OpenBSD: pmap.h,v 1.48 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */
/*
@ -70,6 +70,7 @@
#ifndef _LOCORE
#ifdef _KERNEL
#include <sys/mman.h>
#include <machine/cpufunc.h>
#include <machine/segments.h>
#endif /* _KERNEL */
@ -464,8 +465,8 @@ pmap_update_2pg(vaddr_t va, vaddr_t vb)
__inline static void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
if ((prot & VM_PROT_WRITE) == 0) {
if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC)) {
(void) pmap_clear_attrs(pg, PG_RW);
} else {
pmap_page_remove(pg);
@ -484,8 +485,8 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
__inline static void
pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
if ((prot & VM_PROT_WRITE) == 0) {
if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ| PROT_EXEC)) {
pmap_write_protect(pmap, sva, eva, prot);
} else {
pmap_remove(pmap, sva, eva);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vga_post.c,v 1.7 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: vga_post.c,v 1.8 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: vga_post.c,v 1.12 2009/03/15 21:32:36 cegger Exp $ */
/*-
@ -149,7 +149,7 @@ vga_post_init(int bus, int device, int function)
sc->sys_image = sys_image;
sc->emu.sys_private = sc;
pmap_kenter_pa(sys_bios_data, 0, VM_PROT_READ);
pmap_kenter_pa(sys_bios_data, 0, PROT_READ);
pmap_update(pmap_kernel());
memcpy((void *)sc->bios_data, (void *)sys_bios_data, PAGE_SIZE);
pmap_kremove(sys_bios_data, PAGE_SIZE);
@ -158,14 +158,14 @@ vga_post_init(int bus, int device, int function)
iter = 0;
TAILQ_FOREACH(pg, &sc->ram_backing, pageq) {
pmap_kenter_pa(sc->sys_image + iter, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
iter += PAGE_SIZE;
}
KASSERT(iter == BASE_MEMORY);
for (iter = 640 * 1024; iter < 1024 * 1024; iter += PAGE_SIZE)
pmap_kenter_pa(sc->sys_image + iter, iter,
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
memset(&sc->emu, 0, sizeof(sc->emu));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: arm32_machdep.c,v 1.45 2014/07/10 19:44:35 uebayasi Exp $ */
/* $OpenBSD: arm32_machdep.c,v 1.46 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: arm32_machdep.c,v 1.42 2003/12/30 12:33:15 pk Exp $ */
/*
@ -244,7 +244,7 @@ cpu_startup()
cpu_setup();
/* Lock down zero page */
vector_page_setprot(VM_PROT_READ|VM_PROT_EXECUTE);
vector_page_setprot(PROT_READ | PROT_EXEC);
/*
* Give pmap a chance to set up a few more things now the vm
@ -264,7 +264,7 @@ cpu_startup()
/* msgbufphys was setup during the secondary boot strap */
for (loop = 0; loop < atop(MSGBUFSIZE); ++loop)
pmap_kenter_pa((vaddr_t)msgbufaddr + loop * PAGE_SIZE,
msgbufphys + loop * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE);
msgbufphys + loop * PAGE_SIZE, PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.27 2014/09/13 16:06:36 doug Exp $ */
/* $OpenBSD: bus_dma.c,v 1.28 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
/*-
@ -765,7 +765,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
if (size == 0)
panic("_bus_dmamem_map: size botch");
pmap_kenter_cache(va, addr,
VM_PROT_READ | VM_PROT_WRITE,
PROT_READ | PROT_WRITE,
!(flags & BUS_DMA_COHERENT));
#ifdef DEBUG_DMA

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.19 2014/11/14 09:56:06 dlg Exp $ */
/* $OpenBSD: cpu.c,v 1.20 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.56 2004/04/14 04:01:49 bsh Exp $ */
@ -530,7 +530,7 @@ cpu_alloc_idlepcb(struct cpu_info *ci)
*/
if (uvm_uarea_alloc(&uaddr)) {
error = uvm_fault_wire(kernel_map, uaddr, uaddr + USPACE,
VM_FAULT_WIRE, VM_PROT_READ | VM_PROT_WRITE);
VM_FAULT_WIRE, PROT_READ | PROT_WRITE);
if (error)
return error;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.8 2014/07/13 12:11:01 jasper Exp $ */
/* $OpenBSD: db_interface.c,v 1.9 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: db_interface.c,v 1.34 2003/10/26 23:11:15 chris Exp $ */
/*
@ -245,7 +245,7 @@ db_write_text(vaddr_t addr, size_t size, char *data)
pgva = (vaddr_t)dst & L1_S_FRAME;
limit = L1_S_SIZE - ((vaddr_t)dst & L1_S_OFFSET);
tmppde = oldpde | L1_S_PROT(PTE_KERNEL, VM_PROT_WRITE);
tmppde = oldpde | L1_S_PROT(PTE_KERNEL, PROT_WRITE);
*pde = tmppde;
PTE_SYNC(pde);
break;
@ -257,7 +257,7 @@ db_write_text(vaddr_t addr, size_t size, char *data)
if (pte == NULL)
goto no_mapping;
oldpte = *pte;
tmppte = oldpte | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE);
tmppte = oldpte | L2_S_PROT(PTE_KERNEL, PROT_WRITE);
*pte = tmppte;
PTE_SYNC(pte);
break;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fault.c,v 1.17 2014/05/08 21:17:00 miod Exp $ */
/* $OpenBSD: fault.c,v 1.18 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: fault.c,v 1.46 2004/01/21 15:39:21 skrll Exp $ */
/*
@ -343,22 +343,22 @@ data_abort_handler(trapframe_t *tf)
* responsible to determine if it was a write.
*/
if (IS_PERMISSION_FAULT(fsr))
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
else {
u_int insn = *(u_int *)tf->tf_pc;
if (((insn & 0x0c100000) == 0x04000000) || /* STR/STRB */
((insn & 0x0e1000b0) == 0x000000b0) || /* STRH/STRD */
((insn & 0x0a100000) == 0x08000000)) /* STM/CDT */
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
else
if ((insn & 0x0fb00ff0) == 0x01000090) /* SWP */
ftype = VM_PROT_READ | VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
else
ftype = VM_PROT_READ;
ftype = PROT_READ;
}
#else
ftype = fsr & FAULT_WNR ? VM_PROT_WRITE : VM_PROT_READ;
ftype = fsr & FAULT_WNR ? PROT_WRITE : PROT_READ;
#endif
/*
@ -689,7 +689,7 @@ prefetch_abort_handler(trapframe_t *tf)
#ifdef DEBUG
last_fault_code = -1;
#endif
if (pmap_fault_fixup(map->pmap, va, VM_PROT_READ|VM_PROT_EXECUTE, 1))
if (pmap_fault_fixup(map->pmap, va, PROT_READ | PROT_EXEC, 1))
goto out;
#ifdef DIAGNOSTIC
@ -699,7 +699,7 @@ prefetch_abort_handler(trapframe_t *tf)
}
#endif
error = uvm_fault(map, va, 0, VM_PROT_READ|VM_PROT_EXECUTE);
error = uvm_fault(map, va, 0, PROT_READ | PROT_EXEC);
if (__predict_true(error == 0))
goto out;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fiq.c,v 1.5 2014/04/03 10:17:34 mpi Exp $ */
/* $OpenBSD: fiq.c,v 1.6 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: fiq.c,v 1.5 2002/04/03 23:33:27 thorpej Exp $ */
/*
@ -65,13 +65,13 @@ static void
fiq_installhandler(void *func, size_t size)
{
#if !defined(__ARM_FIQ_INDIRECT)
vector_page_setprot(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
vector_page_setprot(PROT_READ | PROT_WRITE | PROT_EXEC);
#endif
memcpy(fiqvector, func, size);
#if !defined(__ARM_FIQ_INDIRECT)
vector_page_setprot(VM_PROT_READ|VM_PROT_EXECUTE);
vector_page_setprot(PROT_READ | PROT_EXEC);
#endif
cpu_icache_sync_range((vaddr_t) fiqvector, size);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mem.c,v 1.10 2010/12/26 15:40:59 miod Exp $ */
/* $OpenBSD: mem.c,v 1.11 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */
/*
@ -183,8 +183,8 @@ mmrw(dev, uio, flags)
case DEV_MEM:
v = uio->uio_offset;
prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
VM_PROT_WRITE;
prot = uio->uio_rw == UIO_READ ? PROT_READ :
PROT_WRITE;
pmap_enter(pmap_kernel(), (vaddr_t)memhook,
trunc_page(v), prot, prot|PMAP_WIRED);
pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.47 2014/10/07 07:14:55 jsg Exp $ */
/* $OpenBSD: pmap.c,v 1.48 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@ -1871,7 +1871,7 @@ pmap_create(void)
* Map the vector page.
*/
pmap_enter(pm, vector_page, systempage.pv_pa,
VM_PROT_READ, VM_PROT_READ | PMAP_WIRED);
PROT_READ, PROT_READ | PMAP_WIRED);
pmap_update(pm);
}
@ -1902,7 +1902,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
NPDEBUG(PDB_ENTER, printf("pmap_enter: pm %p va 0x%lx pa 0x%lx prot %x flag %x\n", pm, va, pa, prot, flags));
KDASSERT((flags & PMAP_WIRED) == 0 || (flags & VM_PROT_ALL) != 0);
KDASSERT((flags & PMAP_WIRED) == 0 || (flags & PROT_MASK) != 0);
KDASSERT(((va | pa) & PGOFSET) == 0);
/*
@ -1912,9 +1912,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
pg = pmap_initialized ? PHYS_TO_VM_PAGE(pa) : NULL;
nflags = 0;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
nflags |= PVF_WRITE;
if (prot & VM_PROT_EXECUTE)
if (prot & PROT_EXEC)
nflags |= PVF_EXEC;
if (flags & PMAP_WIRED)
nflags |= PVF_WIRED;
@ -1960,7 +1960,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
/*
* This is to be a managed mapping.
*/
if ((flags & VM_PROT_ALL) ||
if ((flags & PROT_MASK) ||
(pg->mdpage.pvh_attrs & PVF_REF)) {
/*
* - The access type indicates that we don't need
@ -1973,8 +1973,8 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
nflags |= PVF_REF;
if ((prot & VM_PROT_WRITE) != 0 &&
((flags & VM_PROT_WRITE) != 0 ||
if ((prot & PROT_WRITE) != 0 &&
((flags & PROT_WRITE) != 0 ||
(pg->mdpage.pvh_attrs & PVF_MOD) != 0)) {
/*
* This is a writable mapping, and the
@ -2011,7 +2011,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
if (pm->pm_cstate.cs_cache_d &&
(oflags & PVF_NC) == 0 &&
(opte & L2_S_PROT_KW) != 0 &&
(prot & VM_PROT_WRITE) == 0)
(prot & PROT_WRITE) == 0)
cpu_dcache_wb_range(va, PAGE_SIZE);
} else {
/*
@ -2071,7 +2071,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* the get go as we don't need to track ref/mod status.
*/
npte |= L2_S_PROTO;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
npte |= L2_S_PROT_KW;
/*
@ -2552,12 +2552,12 @@ pmap_protect(pmap_t pm, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
printf("pmap_protect: pm %p sva 0x%lx eva 0x%lx prot 0x%x\n",
pm, sva, eva, prot));
if ((prot & VM_PROT_READ) == 0) {
if ((prot & PROT_READ) == 0) {
pmap_remove(pm, sva, eva);
return;
}
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
/*
* If this is a read->write transition, just ignore it and let
* uvm_fault() take care of it later.
@ -2648,12 +2648,12 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
pg, pg->phys_addr, prot));
switch(prot) {
case VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE:
case VM_PROT_READ|VM_PROT_WRITE:
case PROT_READ | PROT_WRITE | PROT_EXEC:
case PROT_READ | PROT_WRITE:
return;
case VM_PROT_READ:
case VM_PROT_READ|VM_PROT_EXECUTE:
case PROT_READ:
case PROT_READ | PROT_EXEC:
pmap_clearbit(pg, PVF_WRITE);
break;
@ -2765,7 +2765,7 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, vm_prot_t ftype, int user)
pa = l2pte_pa(pte);
if ((ftype & VM_PROT_WRITE) && (pte & L2_S_PROT_KW) == 0) {
if ((ftype & PROT_WRITE) && (pte & L2_S_PROT_KW) == 0) {
/*
* This looks like a good candidate for "page modified"
* emulation...
@ -3226,7 +3226,7 @@ pmap_zero_page_generic(struct vm_page *pg)
* zeroed page. Invalidate the TLB as needed.
*/
*cdst_pte = L2_S_PROTO | phys |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
cpu_cpwait();
@ -3252,7 +3252,7 @@ pmap_zero_page_xscale(struct vm_page *pg)
* zeroed page. Invalidate the TLB as needed.
*/
*cdst_pte = L2_S_PROTO | phys |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) |
L2_S_PROT(PTE_KERNEL, PROT_WRITE) |
L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X); /* mini-data */
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
@ -3287,7 +3287,7 @@ pmap_pageidlezero(struct vm_page *pg)
* zeroed page. Invalidate the TLB as needed.
*/
*cdst_pte = L2_S_PROTO | phys |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
cpu_cpwait();
@ -3352,10 +3352,10 @@ pmap_copy_page_generic(struct vm_page *src_pg, struct vm_page *dst_pg)
* as required.
*/
*csrc_pte = L2_S_PROTO | src |
L2_S_PROT(PTE_KERNEL, VM_PROT_READ) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_READ) | pte_l2_s_cache_mode;
PTE_SYNC(csrc_pte);
*cdst_pte = L2_S_PROTO | dst |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(csrcp);
cpu_tlb_flushD_SE(cdstp);
@ -3395,11 +3395,11 @@ pmap_copy_page_xscale(struct vm_page *src_pg, struct vm_page *dst_pg)
* as required.
*/
*csrc_pte = L2_S_PROTO | src |
L2_S_PROT(PTE_KERNEL, VM_PROT_READ) |
L2_S_PROT(PTE_KERNEL, PROT_READ) |
L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X); /* mini-data */
PTE_SYNC(csrc_pte);
*cdst_pte = L2_S_PROTO | dst |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) |
L2_S_PROT(PTE_KERNEL, PROT_WRITE) |
L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X); /* mini-data */
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(csrcp);
@ -3443,7 +3443,7 @@ pmap_copy_page_v7(struct vm_page *src_pg, struct vm_page *dst_pg)
L2_V7_AP(0x5) | pte_l2_s_cache_mode;
PTE_SYNC(csrc_pte);
*cdst_pte = L2_S_PROTO | dst |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(csrcp);
cpu_tlb_flushD_SE(cdstp);
@ -3498,7 +3498,7 @@ pmap_grow_map(vaddr_t va, pt_entry_t cache_mode, paddr_t *pap)
ptep = &l2b->l2b_kva[l2pte_index(va)];
*ptep = L2_S_PROTO | pa | cache_mode |
L2_S_PROT(PTE_KERNEL, VM_PROT_READ | VM_PROT_WRITE);
L2_S_PROT(PTE_KERNEL, PROT_READ | PROT_WRITE);
PTE_SYNC(ptep);
memset((void *)va, 0, PAGE_SIZE);
return (0);
@ -4157,7 +4157,7 @@ pmap_postinit(void)
paddr_t pa = VM_PAGE_TO_PHYS(m);
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
/*
* Make sure the L1 descriptor table is mapped
@ -4973,7 +4973,7 @@ xscale_setup_minidata(vaddr_t l1pt, vaddr_t va, paddr_t pa)
#else
pte[l2pte_index(va)] =
#endif
L2_S_PROTO | pa | L2_S_PROT(PTE_KERNEL, VM_PROT_READ) |
L2_S_PROTO | pa | L2_S_PROT(PTE_KERNEL, PROT_READ) |
L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap7.c,v 1.17 2014/10/27 00:49:05 jsg Exp $ */
/* $OpenBSD: pmap7.c,v 1.18 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@ -691,7 +691,7 @@ printf("%s: %d %d\n", __func__, domain, ++nl1);
for (eva = va + L1_TABLE_SIZE; va < eva; va += PAGE_SIZE) {
paddr_t pa = VM_PAGE_TO_PHYS(m);
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
/*
* Make sure the L1 descriptor table is mapped
* with the cache-mode set to write-through, or
@ -1052,7 +1052,7 @@ pmap_clearbit(struct vm_page *pg, u_int maskbits)
/* make the pte read only */
npte = (npte & ~L2_S_PROT_MASK) |
L2_S_PROT(pm == pmap_kernel() ? PTE_KERNEL : PTE_USER,
npte & L2_V7_S_XN ? VM_PROT_READ : VM_PROT_READ | VM_PROT_EXECUTE);
npte & L2_V7_S_XN ? PROT_READ : PROT_READ | PROT_EXEC);
}
if (maskbits & PVF_REF) {
@ -1154,7 +1154,7 @@ pmap_clean_page(struct vm_page *pg, int isync)
*/
if (!wb) {
*cwb_pte = L2_S_PROTO | VM_PAGE_TO_PHYS(pg) |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cwb_pte);
cpu_tlb_flushD_SE(cwbp);
cpu_cpwait();
@ -1311,7 +1311,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
NPDEBUG(PDB_ENTER, printf("pmap_enter: pm %p va 0x%lx pa 0x%lx prot %x flag %x\n", pm, va, pa, prot, flags));
KDASSERT((flags & PMAP_WIRED) == 0 || (flags & VM_PROT_ALL) != 0);
KDASSERT((flags & PMAP_WIRED) == 0 || (flags & PROT_MASK) != 0);
KDASSERT(((va | pa) & PGOFSET) == 0);
/*
@ -1321,9 +1321,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
pg = pmap_initialized ? PHYS_TO_VM_PAGE(pa) : NULL;
nflags = 0;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
nflags |= PVF_WRITE;
if (prot & VM_PROT_EXECUTE)
if (prot & PROT_EXEC)
nflags |= PVF_EXEC;
if (flags & PMAP_WIRED)
nflags |= PVF_WIRED;
@ -1369,7 +1369,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
/*
* This has to be a managed mapping.
*/
if ((flags & VM_PROT_ALL) ||
if ((flags & PROT_MASK) ||
(pg->mdpage.pvh_attrs & PVF_REF)) {
/*
* - The access type indicates that we don't need
@ -1382,8 +1382,8 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
nflags |= PVF_REF;
if ((prot & VM_PROT_WRITE) != 0 &&
((flags & VM_PROT_WRITE) != 0 ||
if ((prot & PROT_WRITE) != 0 &&
((flags & PROT_WRITE) != 0 ||
(pg->mdpage.pvh_attrs & PVF_MOD) != 0)) {
/*
* This is a writable mapping, and the
@ -1399,7 +1399,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
*/
npte &= ~L2_TYPE_MASK;
npte |= L2_TYPE_INV;
prot &= ~VM_PROT_WRITE;
prot &= ~PROT_WRITE;
mapped = 0;
}
@ -1419,7 +1419,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
*/
if ((oflags & PVF_NC) == 0 &&
l2pte_is_writeable(opte, pm) &&
(prot & VM_PROT_WRITE) == 0) {
(prot & PROT_WRITE) == 0) {
cpu_dcache_wb_range(va, PAGE_SIZE);
cpu_sdcache_wb_range(va, opte & L2_S_FRAME,
PAGE_SIZE);
@ -1477,7 +1477,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* Make sure userland mappings get the right permissions
*/
npte |= L2_S_PROT(pm == pmap_kernel() ? PTE_KERNEL : PTE_USER,
prot & ~VM_PROT_WRITE);
prot & ~PROT_WRITE);
/*
* Keep the stats up to date
@ -1530,7 +1530,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* Make sure executable pages do not have stale data in I$,
* which is VIPT.
*/
if (mapped && (prot & VM_PROT_EXECUTE) != 0 && pmap_is_current(pm))
if (mapped && (prot & PROT_EXEC) != 0 && pmap_is_current(pm))
cpu_icache_sync_range(va, PAGE_SIZE);
pmap_release_pmap_lock(pm);
@ -1822,13 +1822,13 @@ pmap_protect(pmap_t pm, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
printf("pmap_protect: pm %p sva 0x%lx eva 0x%lx prot 0x%x",
pm, sva, eva, prot));
if ((prot & VM_PROT_READ) == 0) {
if ((prot & PROT_READ) == 0) {
NPDEBUG(PDB_PROTECT, printf("\n"));
pmap_remove(pm, sva, eva);
return;
}
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
/*
* If this is a read->write transition, just ignore it and let
* uvm_fault() take care of it later.
@ -1878,7 +1878,7 @@ NPDEBUG(PDB_PROTECT, printf("\n"));
pmap_clean_page(pg, FALSE);
pte = (pte & ~L2_S_PROT_MASK) |
L2_S_PROT(pm == pmap_kernel() ? PTE_KERNEL : PTE_USER,
pte & L2_V7_S_XN ? VM_PROT_READ : VM_PROT_READ | VM_PROT_EXECUTE);
pte & L2_V7_S_XN ? PROT_READ : PROT_READ | PROT_EXEC);
*ptep = pte;
PTE_SYNC(ptep);
@ -1926,12 +1926,12 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
pg, pg->phys_addr, prot));
switch(prot) {
case VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE:
case VM_PROT_READ|VM_PROT_WRITE:
case PROT_READ | PROT_WRITE | PROT_EXEC:
case PROT_READ | PROT_WRITE:
return;
case VM_PROT_READ:
case VM_PROT_READ|VM_PROT_EXECUTE:
case PROT_READ:
case PROT_READ | PROT_EXEC:
pmap_clearbit(pg, PVF_WRITE);
break;
@ -2041,14 +2041,14 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, vm_prot_t ftype, int user)
*/
if (user) {
/* XXX use of L2_V7_S_XN */
if ((pte & L2_S_PROT_MASK & ~L2_V7_S_XN) != L2_S_PROT(PTE_USER, VM_PROT_READ) &&
(pte & L2_S_PROT_MASK & ~L2_V7_S_XN) != L2_S_PROT(PTE_USER, VM_PROT_WRITE))
if ((pte & L2_S_PROT_MASK & ~L2_V7_S_XN) != L2_S_PROT(PTE_USER, PROT_READ) &&
(pte & L2_S_PROT_MASK & ~L2_V7_S_XN) != L2_S_PROT(PTE_USER, PROT_WRITE))
goto out;
}
pa = l2pte_pa(pte);
if ((ftype & VM_PROT_EXECUTE) && (pte & L2_V7_S_XN)) {
if ((ftype & PROT_EXEC) && (pte & L2_V7_S_XN)) {
printf("%s: va %08lx ftype %x %c pte %08x\n", __func__, va, ftype, user ? 'u' : 's', pte);
printf("fault on exec\n");
#ifdef DDB
@ -2057,7 +2057,7 @@ Debugger();
/* XXX FIX THIS */
goto out;
}
if ((ftype & VM_PROT_WRITE) && !l2pte_is_writeable(pte, pm)) {
if ((ftype & PROT_WRITE) && !l2pte_is_writeable(pte, pm)) {
/*
* This looks like a good candidate for "page modified"
* emulation...
@ -2098,7 +2098,7 @@ Debugger();
*/
*ptep = (pte & ~(L2_TYPE_MASK|L2_S_PROT_MASK)) | L2_S_PROTO |
L2_S_PROT(pm == pmap_kernel() ? PTE_KERNEL : PTE_USER,
pte & L2_V7_S_XN ? VM_PROT_WRITE : VM_PROT_WRITE | VM_PROT_EXECUTE);
pte & L2_V7_S_XN ? PROT_WRITE : PROT_WRITE | PROT_EXEC);
PTE_SYNC(ptep);
rv = 1;
} else
@ -2361,7 +2361,7 @@ pmap_zero_page_generic(struct vm_page *pg)
* zeroed page. Invalidate the TLB as needed.
*/
*cdst_pte = L2_S_PROTO | phys |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
cpu_cpwait();
@ -2391,10 +2391,10 @@ pmap_copy_page_generic(struct vm_page *src_pg, struct vm_page *dst_pg)
* as required.
*/
*csrc_pte = L2_S_PROTO | src |
L2_S_PROT(PTE_KERNEL, VM_PROT_READ) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_READ) | pte_l2_s_cache_mode;
PTE_SYNC(csrc_pte);
*cdst_pte = L2_S_PROTO | dst |
L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode;
L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode;
PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(csrcp);
cpu_tlb_flushD_SE(cdstp);
@ -2445,7 +2445,7 @@ pmap_grow_map(vaddr_t va, pt_entry_t cache_mode, paddr_t *pap)
ptep = &l2b->l2b_kva[l2pte_index(va)];
*ptep = L2_S_PROTO | pa | cache_mode |
L2_S_PROT(PTE_KERNEL, VM_PROT_READ | VM_PROT_WRITE);
L2_S_PROT(PTE_KERNEL, PROT_READ | PROT_WRITE);
PTE_SYNC(ptep);
cpu_tlb_flushD_SE(va);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: stubs.c,v 1.8 2013/06/11 16:42:07 deraadt Exp $ */
/* $OpenBSD: stubs.c,v 1.9 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: stubs.c,v 1.14 2003/07/15 00:24:42 lukem Exp $ */
/*
@ -196,7 +196,7 @@ dumpsys()
addr += PAGE_SIZE) {
if ((len % (1024*1024)) == 0)
printf("%d ", len / (1024*1024));
pmap_kenter_pa(dumpspace, addr, VM_PROT_READ);
pmap_kenter_pa(dumpspace, addr, PROT_READ);
pmap_update(pmap_kernel());
error = (*bdev->d_dump)(dumpdev,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.13 2013/01/16 19:04:43 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.14 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.31 2004/01/04 11:33:29 jdolecek Exp $ */
/*
@ -262,7 +262,8 @@ vmapbuf(bp, len)
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &fpa);
pmap_enter(pmap_kernel(), taddr, fpa,
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;
len -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: armv7_space.c,v 1.5 2013/07/11 16:16:38 rapha Exp $ */
/* $OpenBSD: armv7_space.c,v 1.6 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@ -192,7 +192,7 @@ armv7_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.h,v 1.27 2014/10/07 10:10:58 jsg Exp $ */
/* $OpenBSD: pmap.h,v 1.28 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */
/*
@ -682,15 +682,15 @@ L1_S_PROT(int ku, vm_prot_t pr)
pt_entry_t pte;
if (ku == PTE_USER)
pte = (pr & VM_PROT_WRITE) ? L1_S_PROT_UW : L1_S_PROT_UR;
pte = (pr & PROT_WRITE) ? L1_S_PROT_UW : L1_S_PROT_UR;
else
pte = (pr & VM_PROT_WRITE) ? L1_S_PROT_KW : L1_S_PROT_KR;
pte = (pr & PROT_WRITE) ? L1_S_PROT_KW : L1_S_PROT_KR;
/*
* If we set the XN bit, the abort handlers or the vector page
* might be marked as such. Needs Debugging.
*/
/*
if ((pr & VM_PROT_EXECUTE) == 0)
if ((pr & PROT_EXEC) == 0)
pte |= L1_S_V7_XN;
*/
@ -702,15 +702,15 @@ L2_L_PROT(int ku, vm_prot_t pr)
pt_entry_t pte;
if (ku == PTE_USER)
pte = (pr & VM_PROT_WRITE) ? L2_L_PROT_UW : L2_L_PROT_UR;
pte = (pr & PROT_WRITE) ? L2_L_PROT_UW : L2_L_PROT_UR;
else
pte = (pr & VM_PROT_WRITE) ? L2_L_PROT_KW : L2_L_PROT_KR;
pte = (pr & PROT_WRITE) ? L2_L_PROT_KW : L2_L_PROT_KR;
/*
* If we set the XN bit, the abort handlers or the vector page
* might be marked as such. Needs Debugging.
*/
/*
if ((pr & VM_PROT_EXECUTE) == 0)
if ((pr & PROT_EXEC) == 0)
pte |= L2_V7_L_XN;
*/
@ -722,15 +722,15 @@ L2_S_PROT(int ku, vm_prot_t pr)
pt_entry_t pte;
if (ku == PTE_USER)
pte = (pr & VM_PROT_WRITE) ? L2_S_PROT_UW : L2_S_PROT_UR;
pte = (pr & PROT_WRITE) ? L2_S_PROT_UW : L2_S_PROT_UR;
else
pte = (pr & VM_PROT_WRITE) ? L2_S_PROT_KW : L2_S_PROT_KR;
pte = (pr & PROT_WRITE) ? L2_S_PROT_KW : L2_S_PROT_KR;
/*
* If we set the XN bit, the abort handlers or the vector page
* might be marked as such. Needs Debugging.
*/
/*
if ((pr & VM_PROT_EXECUTE) == 0)
if ((pr & PROT_EXEC) == 0)
pte |= L2_V7_S_XN;
*/
@ -743,7 +743,7 @@ l2pte_is_writeable(pt_entry_t pte, struct pmap *pm)
/* XXX use of L2_V7_S_XN */
return (pte & L2_S_PROT_MASK & ~L2_V7_S_XN) ==
L2_S_PROT(pm == pmap_kernel() ? PTE_KERNEL : PTE_USER,
VM_PROT_WRITE);
PROT_WRITE);
}
#endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: i80321_space.c,v 1.4 2006/06/01 03:46:01 drahn Exp $ */
/* $OpenBSD: i80321_space.c,v 1.5 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: i80321_space.c,v 1.9 2005/11/24 13:08:32 yamt Exp $ */
/*
@ -211,7 +211,7 @@ printf("i80321_bs_map va %x pa %x, endpa %x, sz %x\n", va, startpa,
for (pa = startpa; pagecnt > 0;
pa += PAGE_SIZE, va += PAGE_SIZE, pagecnt -= PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;
@ -385,7 +385,7 @@ printf("i80321_bs_map va %x pa %x, endpa %x, sz %x\n", va, pa,
*bshp = va + (bpa & PAGE_MASK);
for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pxa2x0_space.c,v 1.4 2008/05/15 22:17:08 brad Exp $ */
/* $OpenBSD: pxa2x0_space.c,v 1.5 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: pxa2x0_space.c,v 1.5 2004/06/07 19:45:22 nathanw Exp $ */
/*
@ -194,7 +194,7 @@ pxa2x0_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: armish_machdep.c,v 1.32 2014/09/20 09:28:24 kettenis Exp $ */
/* $OpenBSD: armish_machdep.c,v 1.33 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@ -316,7 +316,7 @@ const struct pmap_devmap iq80321_devmap[] = {
IQ80321_OBIO_BASE,
IQ80321_OBIO_BASE,
0x00100000 /* IQ80321_OBIO_SIZE, */,
VM_PROT_READ|VM_PROT_WRITE,
PROT_READ | PROT_WRITE,
PTE_NOCACHE,
},
{0, 0, 0, 0, 0}
@ -600,10 +600,10 @@ initarm(void *arg0, void *arg1, void *arg2)
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, totalsize - textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
PROT_READ | PROT_WRITE, PTE_CACHE);
}
#ifdef VERBOSE_INIT_ARM
@ -612,21 +612,21 @@ initarm(void *arg0, void *arg1, void *arg2)
/* Map the stack pages */
pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
IRQ_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
ABT_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
UND_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
UPAGES * PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_CACHE);
UPAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
L1_TABLE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_PAGETABLE);
L1_TABLE_SIZE, PROT_READ | PROT_WRITE, PTE_PAGETABLE);
for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
PROT_READ | PROT_WRITE, PTE_PAGETABLE);
}
/* Map the Mini-Data cache clean area. */
@ -636,10 +636,10 @@ initarm(void *arg0, void *arg1, void *arg2)
/* Map the vector page. */
#ifdef HIGH_VECT
pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
PROT_READ | PROT_WRITE, PTE_CACHE);
#else
pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
PROT_READ | PROT_WRITE, PTE_CACHE);
#endif
pmap_devmap_bootstrap(l1pagetable, iq80321_devmap);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: obio_space.c,v 1.2 2006/05/29 17:30:26 drahn Exp $ */
/* $OpenBSD: obio_space.c,v 1.3 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: obio_space.c,v 1.9 2005/11/24 13:08:33 yamt Exp $ */
@ -160,7 +160,7 @@ obio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: armv7_machdep.c,v 1.15 2014/09/20 09:28:24 kettenis Exp $ */
/* $OpenBSD: armv7_machdep.c,v 1.16 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@ -355,7 +355,7 @@ bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
for (pa = startpa; pa < endpa; pa += L1_S_SIZE, va += L1_S_SIZE)
pmap_map_section((vaddr_t)pagedir, va, pa,
VM_PROT_READ | VM_PROT_WRITE, PTE_NOCACHE);
PROT_READ | PROT_WRITE, PTE_NOCACHE);
cpu_tlb_flushD();
@ -626,10 +626,10 @@ initarm(void *arg0, void *arg1, void *arg2)
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, textsize,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE);
PROT_READ | PROT_WRITE | PROT_EXEC, PTE_CACHE);
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, totalsize - textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
PROT_READ | PROT_WRITE, PTE_CACHE);
}
#ifdef VERBOSE_INIT_ARM
@ -638,28 +638,28 @@ initarm(void *arg0, void *arg1, void *arg2)
/* Map the stack pages */
pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
IRQ_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
ABT_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
UND_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
UPAGES * PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_CACHE);
UPAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
L1_TABLE_SIZE, VM_PROT_READ | VM_PROT_WRITE, PTE_PAGETABLE);
L1_TABLE_SIZE, PROT_READ | PROT_WRITE, PTE_PAGETABLE);
for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
PROT_READ | PROT_WRITE, PTE_PAGETABLE);
}
/* Map the Mini-Data cache clean area. */
/* Map the vector page. */
pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE);
PROT_READ | PROT_WRITE | PROT_EXEC, PTE_CACHE);
/*
* map integrated peripherals at same address in l1pagetable

View File

@ -1,4 +1,4 @@
/* $OpenBSD: av400_machdep.c,v 1.26 2013/10/23 10:07:14 miod Exp $ */
/* $OpenBSD: av400_machdep.c,v 1.27 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007, Miodrag Vallat.
*
@ -170,9 +170,9 @@ void av400_ipi_handler(struct trapframe *);
const struct pmap_table
av400_ptable[] = {
{ AV400_PROM, AV400_PROM_SIZE, UVM_PROT_RW, CACHE_INH },
{ AV400_PROM, AV400_PROM_SIZE, PROT_READ | PROT_WRITE, CACHE_INH },
#if 0 /* mapped by the hardcoded BATC entries */
{ AV400_UTILITY,AV400_UTILITY_SIZE, UVM_PROT_RW, CACHE_INH },
{ AV400_UTILITY,AV400_UTILITY_SIZE, PROT_READ | PROT_WRITE, CACHE_INH },
#endif
{ 0, (vsize_t)-1, 0, 0 }
};

View File

@ -1,4 +1,4 @@
/* $OpenBSD: av530_machdep.c,v 1.12 2013/10/23 10:07:14 miod Exp $ */
/* $OpenBSD: av530_machdep.c,v 1.13 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007, 2010 Miodrag Vallat.
*
@ -59,9 +59,9 @@ void av530_ipi_handler(struct trapframe *);
const struct pmap_table
av530_ptable[] = {
{ AV530_PROM, AV530_PROM_SIZE, UVM_PROT_RW, CACHE_INH },
{ AV530_PROM, AV530_PROM_SIZE, PROT_READ | PROT_WRITE, CACHE_INH },
#if 0 /* mapped by the hardcoded BATC entries */
{ AV530_UTILITY,AV530_UTILITY_SIZE, UVM_PROT_RW, CACHE_INH },
{ AV530_UTILITY,AV530_UTILITY_SIZE, PROT_READ | PROT_WRITE, CACHE_INH },
#endif
{ 0, (vsize_t)-1, 0, 0 }
};

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.8 2014/09/13 16:06:36 doug Exp $ */
/* $OpenBSD: bus_dma.c,v 1.9 2014/11/16 12:30:56 deraadt Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@ -541,8 +541,8 @@ bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
if (size == 0)
panic("bus_dmamem_map: size botch");
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);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_le_syscon.c,v 1.15 2013/10/23 22:14:22 miod Exp $ */
/* $OpenBSD: if_le_syscon.c,v 1.16 2014/11/16 12:30:56 deraadt Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -237,7 +237,8 @@ le_syscon_attach(struct device *parent, struct device *self, void *aux)
TAILQ_FOREACH(pg, &pglist, pageq) {
pmap_enter(pmap_kernel(), va, pa,
UVM_PROT_RW, UVM_PROT_RW | PMAP_WIRED);
PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | PMAP_WIRED);
va += PAGE_SIZE;
pa += PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vme.c,v 1.14 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: vme.c,v 1.15 2014/11/16 12:30:56 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007, 2010 Miodrag Vallat.
*
@ -477,7 +477,7 @@ vme_map(struct vme_softc *sc, struct extent *ext, u_int awidth,
/*
* Allocate virtual memory for the range and map it.
*/
rc = vme_map_r(r, pa, len, flags, UVM_PROT_RW, rva);
rc = vme_map_r(r, pa, len, flags, PROT_READ | PROT_WRITE, rva);
if (rc != 0) {
if (ext != NULL)
(void)extent_free(ext, atop(pa), atop(len),
@ -948,7 +948,8 @@ vmerw(struct vme_softc *sc, int awidth, int dwidth, struct uio *uio, int flags)
/* len = min(len, (off_t)r->vr_end - uio->uio_offset); */
rc = vme_map_r(r, trunc_page(uio->uio_offset), PAGE_SIZE, 0,
uio->uio_rw == UIO_READ ? UVM_PROT_R : UVM_PROT_RW, &vmepg);
uio->uio_rw == UIO_READ ? PROT_READ : PROT_READ | PROT_WRITE,
&vmepg);
if (rc != 0)
break;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: astro.c,v 1.16 2014/10/25 10:19:20 kettenis Exp $ */
/* $OpenBSD: astro.c,v 1.17 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2007 Mark Kettenis
@ -292,7 +292,7 @@ astro_attach(struct device *parent, struct device *self, void *aux)
for (; m != NULL; m = TAILQ_NEXT(m, pageq)) {
pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
PROT_READ | PROT_WRITE, PMAP_WIRED);
va += PAGE_SIZE;
}
pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mainbus.c,v 1.85 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: mainbus.c,v 1.86 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@ -220,7 +220,7 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
if (btlb_insert(HPPA_SID_KERNEL, spa, spa, &len,
pmap_sid2pid(HPPA_SID_KERNEL) |
pmap_prot(pmap_kernel(), UVM_PROT_RW))
pmap_prot(pmap_kernel(), PROT_READ | PROT_WRITE))
>= 0) {
pa = spa + len; /* may wrap to 0... */
#ifdef BTLBDEBUG
@ -247,7 +247,7 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
#endif
for (; spa != epa; spa += PAGE_SIZE)
pmap_kenter_pa(spa, spa,
UVM_PROT_RW);
PROT_READ | PROT_WRITE);
}
#ifdef BTLBDEBUG
printf("\n");

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.162 2014/05/12 14:35:56 kettenis Exp $ */
/* $OpenBSD: pmap.c,v 1.163 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@ -463,14 +463,14 @@ pmap_bootstrap(vaddr_t vstart)
uvm_setpagesize();
hppa_prot[UVM_PROT_NONE] = TLB_AR_NA;
hppa_prot[UVM_PROT_READ] = TLB_AR_R;
hppa_prot[UVM_PROT_WRITE] = TLB_AR_RW;
hppa_prot[UVM_PROT_RW] = TLB_AR_RW;
hppa_prot[UVM_PROT_EXEC] = TLB_AR_RX;
hppa_prot[UVM_PROT_RX] = TLB_AR_RX;
hppa_prot[UVM_PROT_WX] = TLB_AR_RWX;
hppa_prot[UVM_PROT_RWX] = TLB_AR_RWX;
hppa_prot[PROT_NONE] = TLB_AR_NA;
hppa_prot[PROT_READ] = TLB_AR_R;
hppa_prot[PROT_WRITE] = TLB_AR_RW;
hppa_prot[PROT_READ | PROT_WRITE] = TLB_AR_RW;
hppa_prot[PROT_EXEC] = TLB_AR_RX;
hppa_prot[PROT_READ | PROT_EXEC] = TLB_AR_RX;
hppa_prot[PROT_WRITE | PROT_EXEC] = TLB_AR_RWX;
hppa_prot[PROT_READ | PROT_WRITE | PROT_EXEC] = TLB_AR_RWX;
/*
* Initialize kernel pmap
@ -547,7 +547,7 @@ pmap_bootstrap(vaddr_t vstart)
if (btlb_insert(HPPA_SID_KERNEL, va, va, &size,
pmap_sid2pid(HPPA_SID_KERNEL) |
pmap_prot(pmap_kernel(), UVM_PROT_RX)) < 0) {
pmap_prot(pmap_kernel(), PROT_READ | PROT_EXEC)) < 0) {
printf("WARNING: cannot block map kernel text\n");
break;
}
@ -592,14 +592,14 @@ pmap_bootstrap(vaddr_t vstart)
/* TODO optimize/inline the kenter */
for (va = 0; va < ptoa(physmem); va += PAGE_SIZE) {
extern struct user *proc0paddr;
vm_prot_t prot = UVM_PROT_RW;
vm_prot_t prot = PROT_READ | PROT_WRITE;
if (va < (vaddr_t)&etext)
prot = UVM_PROT_RX;
prot = PROT_READ | PROT_EXEC;
else if (va < (vaddr_t)&__rodata_end)
prot = UVM_PROT_READ;
prot = PROT_READ;
else if (va == (vaddr_t)proc0paddr + USPACE)
prot = UVM_PROT_NONE;
prot = PROT_NONE;
pmap_kenter_pa(va, va, prot);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.137 2014/10/08 22:23:57 deraadt Exp $ */
/* $OpenBSD: trap.c,v 1.138 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@ -170,16 +170,16 @@ trap(int type, struct trapframe *frame)
trapnum == T_IDEBUG || trapnum == T_PERFMON) {
va = frame->tf_iioq_head;
space = frame->tf_iisq_head;
vftype = UVM_PROT_EXEC;
vftype = PROT_EXEC;
} else {
va = frame->tf_ior;
space = frame->tf_isr;
if (va == frame->tf_iioq_head)
vftype = UVM_PROT_EXEC;
vftype = PROT_EXEC;
else if (inst_store(opcode))
vftype = UVM_PROT_WRITE;
vftype = PROT_WRITE;
else
vftype = UVM_PROT_READ;
vftype = PROT_READ;
}
if (frame->tf_flags & TFF_LAST)
@ -447,7 +447,7 @@ trap(int type, struct trapframe *frame)
(frame->tf_iioq_head & 3) != pl ||
(type & T_USER && va >= VM_MAXUSER_ADDRESS) ||
uvm_fault(map, trunc_page(va), fault,
opcode & 0x40? UVM_PROT_WRITE : UVM_PROT_READ)) {
opcode & 0x40? PROT_WRITE : PROT_READ)) {
frame_regmap(frame, opcode & 0x1f) = 0;
frame->tf_ipsw |= PSL_N;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.78 2014/04/08 09:34:23 mpi Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.79 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1999-2004 Michael Shalayeff
@ -203,7 +203,7 @@ vmapbuf(struct buf *bp, vsize_t len)
if (pmap_extract(pm, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
else
pmap_kenter_pa(kva, pa, UVM_PROT_RW);
pmap_kenter_pa(kva, pa, PROT_READ | PROT_WRITE);
uva += PAGE_SIZE;
kva += PAGE_SIZE;
size -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.h,v 1.45 2014/01/30 18:16:41 miod Exp $ */
/* $OpenBSD: pmap.h,v 1.46 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2002-2004 Michael Shalayeff
@ -136,8 +136,8 @@ pmap_prot(struct pmap *pmap, int prot)
static __inline void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
if ((prot & UVM_PROT_WRITE) == 0) {
if (prot & (UVM_PROT_RX))
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC))
pmap_changebit(pg, 0, PTE_PROT(TLB_WRITE));
else
pmap_page_remove(pg);
@ -147,8 +147,8 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
static __inline void
pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
if ((prot & UVM_PROT_WRITE) == 0) {
if (prot & (UVM_PROT_RX))
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC))
pmap_write_protect(pmap, sva, eva, prot);
else
pmap_remove(pmap, sva, eva);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: astro.c,v 1.7 2014/10/25 10:19:20 kettenis Exp $ */
/* $OpenBSD: astro.c,v 1.8 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2007 Mark Kettenis
@ -289,7 +289,7 @@ astro_attach(struct device *parent, struct device *self, void *aux)
for (; m != NULL; m = TAILQ_NEXT(m, pageq)) {
pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
PROT_READ | PROT_WRITE, PMAP_WIRED);
va += PAGE_SIZE;
}
pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mainbus.c,v 1.15 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: mainbus.c,v 1.16 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@ -184,7 +184,7 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
for (spa = trunc_page(bpa), epa = bpa + size;
spa < epa; spa += PAGE_SIZE)
pmap_kenter_pa(spa, spa, UVM_PROT_RW);
pmap_kenter_pa(spa, spa, PROT_READ | PROT_WRITE);
*bshp = bpa;
return (0);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.24 2014/10/12 20:39:46 miod Exp $ */
/* $OpenBSD: pmap.c,v 1.25 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@ -485,14 +485,15 @@ pmap_bootstrap(vaddr_t vstart)
uvmexp.pagesize = PAGE_SIZE;
uvm_setpagesize();
hppa_prot[UVM_PROT_NONE] = PTE_ORDER|PTE_ACC_NONE;
hppa_prot[UVM_PROT_READ] = PTE_ORDER|PTE_READ;
hppa_prot[UVM_PROT_WRITE] = PTE_ORDER|PTE_WRITE;
hppa_prot[UVM_PROT_RW] = PTE_ORDER|PTE_READ|PTE_WRITE;
hppa_prot[UVM_PROT_EXEC] = PTE_ORDER|PTE_EXEC;
hppa_prot[UVM_PROT_RX] = PTE_ORDER|PTE_READ|PTE_EXEC;
hppa_prot[UVM_PROT_WX] = PTE_ORDER|PTE_WRITE|PTE_EXEC;
hppa_prot[UVM_PROT_RWX] = PTE_ORDER|PTE_READ|PTE_WRITE|PTE_EXEC;
hppa_prot[PROT_NONE] = PTE_ORDER|PTE_ACC_NONE;
hppa_prot[PROT_READ] = PTE_ORDER|PTE_READ;
hppa_prot[PROT_WRITE] = PTE_ORDER|PTE_WRITE;
hppa_prot[PROT_READ | PROT_WRITE] = PTE_ORDER|PTE_READ|PTE_WRITE;
hppa_prot[PROT_EXEC] = PTE_ORDER|PTE_EXEC;
hppa_prot[PROT_READ | PROT_EXEC] = PTE_ORDER|PTE_READ|PTE_EXEC;
hppa_prot[PROT_WRITE | PROT_EXEC] = PTE_ORDER|PTE_WRITE|PTE_EXEC;
hppa_prot[PROT_READ | PROT_WRITE | PROT_EXEC] =
PTE_ORDER|PTE_READ|PTE_WRITE|PTE_EXEC;
/*
* Initialize kernel pmap

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.40 2014/10/12 20:39:46 miod Exp $ */
/* $OpenBSD: trap.c,v 1.41 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@ -164,16 +164,16 @@ trap(int type, struct trapframe *frame)
trapnum == T_IPROT) {
va = frame->tf_iioq[0];
space = frame->tf_iisq[0];
vftype = UVM_PROT_EXEC;
vftype = PROT_EXEC;
} else {
va = frame->tf_ior;
space = frame->tf_isr;
if (va == frame->tf_iioq[0])
vftype = UVM_PROT_EXEC;
vftype = PROT_EXEC;
else if (inst_store(opcode))
vftype = UVM_PROT_WRITE;
vftype = PROT_WRITE;
else
vftype = UVM_PROT_READ;
vftype = PROT_READ;
}
if (frame->tf_flags & TFF_LAST)
@ -370,7 +370,7 @@ trap(int type, struct trapframe *frame)
(type & T_USER && !pl) ||
(type & T_USER && va >= VM_MAXUSER_ADDRESS) ||
uvm_fault(map, trunc_page(va), fault,
opcode & 0x40? UVM_PROT_WRITE : UVM_PROT_READ)) {
opcode & 0x40? PROT_WRITE : PROT_READ)) {
frame_regmap(frame, opcode & 0x1f) = 0;
frame->tf_ipsw |= PSL_N;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.20 2014/04/08 09:34:23 mpi Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.21 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@ -193,7 +193,7 @@ vmapbuf(struct buf *bp, vsize_t len)
if (pmap_extract(pm, uva, &pa) == FALSE)
panic("vmapbuf: null page frame");
else
pmap_kenter_pa(kva, pa, UVM_PROT_RW);
pmap_kenter_pa(kva, pa, PROT_READ | PROT_WRITE);
uva += PAGE_SIZE;
kva += PAGE_SIZE;
size -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.h,v 1.12 2014/05/08 21:31:56 miod Exp $ */
/* $OpenBSD: pmap.h,v 1.13 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@ -118,8 +118,8 @@ void pmap_page_remove(struct vm_page *pg);
static __inline void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
if ((prot & UVM_PROT_WRITE) == 0) {
if (prot & (UVM_PROT_RX))
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC))
pmap_changebit(pg, 0, PTE_WRITE);
else
pmap_page_remove(pg);
@ -129,8 +129,8 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
static __inline void
pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
if ((prot & UVM_PROT_WRITE) == 0) {
if (prot & (UVM_PROT_RX))
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC))
pmap_write_protect(pmap, sva, eva, prot);
else
pmap_remove(pmap, sva, eva);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_machdep.c,v 1.56 2014/09/19 20:02:25 kettenis Exp $ */
/* $OpenBSD: acpi_machdep.c,v 1.57 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@ -88,7 +88,7 @@ acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle)
handle->pa = pa;
do {
pmap_kenter_pa(va, pgpa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pgpa, PROT_READ | PROT_WRITE);
va += NBPG;
pgpa += NBPG;
} while (pgpa < endpa);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bios.c,v 1.106 2014/10/17 20:34:23 kettenis Exp $ */
/* $OpenBSD: bios.c,v 1.107 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1997-2001 Michael Shalayeff
@ -282,7 +282,7 @@ biosattach(struct device *parent, struct device *self, void *aux)
smbios_entry.count = sh->count;
for (; pa < end; pa+= NBPG, eva+= NBPG)
pmap_kenter_pa(eva, pa, VM_PROT_READ);
pmap_kenter_pa(eva, pa, PROT_READ);
printf(", SMBIOS rev. %d.%d @ 0x%x (%hd entries)",
sh->majrev, sh->minrev, sh->addr, sh->count);
@ -670,14 +670,14 @@ bios32_service(u_int32_t service, bios32_entry_t e, bios32_entry_info_t ei)
va += trunc_page(BIOS32_START);
pa < endpa; pa += NBPG, va += NBPG) {
pmap_enter(pmap_kernel(), va, 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);
/* for all you, broken hearted */
if (pa >= trunc_page(base)) {
pmap_enter(pmap_kernel(), sva, 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);
sva += NBPG;
}
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.32 2014/07/12 18:44:41 tedu Exp $ */
/* $OpenBSD: bus_dma.c,v 1.33 2014/11/16 12:30:57 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@ -456,8 +456,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
* alloc
*/
ret = pmap_enter(pmap_kernel(), va, addr | pmapflags,
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 (ret) {
pmap_update(pmap_kernel());
km_free((void *)sva, ssize, &kv_any, &kp_none);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.56 2014/09/14 14:17:23 jsg Exp $ */
/* $OpenBSD: cpu.c,v 1.57 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
@ -219,9 +219,8 @@ replacesmap(void)
pmap_extract(pmap_kernel(), kva, &pa1);
pmap_extract(pmap_kernel(), kva + PAGE_SIZE, &pa2);
pmap_kenter_pa(nva, pa1, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(nva + PAGE_SIZE, pa2, VM_PROT_READ |
VM_PROT_WRITE);
pmap_kenter_pa(nva, pa1, PROT_READ | PROT_WRITE);
pmap_kenter_pa(nva + PAGE_SIZE, pa2, PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
/* replace 3 byte nops with stac/clac instructions */
@ -724,7 +723,7 @@ mp_cpu_start(struct cpu_info *ci)
pmap_activate(curproc);
pmap_kenter_pa(0, 0, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(0, 0, PROT_READ | PROT_WRITE);
memcpy((u_int8_t *)0x467, dwordptr, 4);
pmap_kremove(0, PAGE_SIZE);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gdt.c,v 1.33 2014/09/14 14:17:23 jsg Exp $ */
/* $OpenBSD: gdt.c,v 1.34 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: gdt.c,v 1.28 2002/12/14 09:38:50 junyoung Exp $ */
/*-
@ -111,7 +111,7 @@ gdt_init()
if (pg == NULL)
panic("gdt_init: no pages");
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
}
bcopy(bootstrap_gdt, gdt, NGDT * sizeof(union descriptor));
ci->ci_gdt = gdt;
@ -140,7 +140,7 @@ gdt_alloc_cpu(struct cpu_info *ci)
if (pg == NULL)
panic("gdt_init: no pages");
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
}
bzero(ci->ci_gdt, MAXGDTSIZ);
bcopy(gdt, ci->ci_gdt, MAXGDTSIZ);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: hibernate_machdep.c,v 1.40 2014/11/08 08:18:37 mlarkin Exp $ */
/* $OpenBSD: hibernate_machdep.c,v 1.41 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
@ -239,9 +239,9 @@ hibernate_populate_resume_pt(union hibernate_info *hib_info,
vaddr_t piglet_start_va, piglet_end_va;
/* Identity map PD, PT, and stack pages */
pmap_kenter_pa(HIBERNATE_PT_PAGE, HIBERNATE_PT_PAGE, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PD_PAGE, HIBERNATE_PD_PAGE, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_STACK_PAGE, HIBERNATE_STACK_PAGE, VM_PROT_ALL);
pmap_kenter_pa(HIBERNATE_PT_PAGE, HIBERNATE_PT_PAGE, PROT_MASK);
pmap_kenter_pa(HIBERNATE_PD_PAGE, HIBERNATE_PD_PAGE, PROT_MASK);
pmap_kenter_pa(HIBERNATE_STACK_PAGE, HIBERNATE_STACK_PAGE, PROT_MASK);
pmap_activate(curproc);
bzero((caddr_t)HIBERNATE_PT_PAGE, PAGE_SIZE);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kvm86.c,v 1.7 2014/04/01 09:05:03 mpi Exp $ */
/* $OpenBSD: kvm86.c,v 1.8 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: kvm86.c,v 1.10 2005/12/26 19:23:59 perry Exp $ */
/*
* Copyright (c) 2002
@ -207,7 +207,7 @@ kvm86_bios_read(u_int32_t vmva, char *buf, size_t len)
if (!bioscallvmd->pgtbl[vmva >> 12])
break;
vmpa = bioscallvmd->pgtbl[vmva >> 12] & ~(PAGE_SIZE - 1);
pmap_kenter_pa(bioscalltmpva, vmpa, VM_PROT_READ);
pmap_kenter_pa(bioscalltmpva, vmpa, PROT_READ);
pmap_update(pmap_kernel());
memcpy(buf, (void *)(bioscalltmpva + (vmva & (PAGE_SIZE - 1))),

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.556 2014/10/25 16:57:58 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.557 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@ -392,7 +392,7 @@ cpu_startup()
pa = avail_end;
va = (vaddr_t)msgbufp;
for (i = 0; i < atop(MSGBUFSIZE); i++) {
pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
va += PAGE_SIZE;
pa += PAGE_SIZE;
}
@ -2794,7 +2794,7 @@ dumpsys()
printf("(%x %lld) ", maddr, (long long)blkno);
#endif
pmap_enter(pmap_kernel(), dumpspace, maddr,
VM_PROT_READ, PMAP_WIRED);
PROT_READ, PMAP_WIRED);
if ((error = (*dump)(dumpdev, blkno,
(caddr_t)dumpspace, NBPG)))
break;
@ -3148,8 +3148,8 @@ init386(paddr_t first_avail)
panic("cannot reserve /boot args memory");
pmap_enter(pmap_kernel(), (vaddr_t)bootargp, (paddr_t)bootargv,
VM_PROT_READ|VM_PROT_WRITE,
VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | PMAP_WIRED);
bios_getopt();
@ -3322,13 +3322,13 @@ init386(paddr_t first_avail)
#ifdef MULTIPROCESSOR
pmap_kenter_pa((vaddr_t)MP_TRAMPOLINE, /* virtual */
(paddr_t)MP_TRAMPOLINE, /* physical */
VM_PROT_ALL); /* protection */
PROT_MASK); /* protection */
#endif
#if NACPI > 0 && !defined(SMALL_KERNEL)
pmap_kenter_pa((vaddr_t)ACPI_TRAMPOLINE,/* virtual */
(paddr_t)ACPI_TRAMPOLINE, /* physical */
VM_PROT_ALL); /* protection */
PROT_MASK); /* protection */
#endif
tlbflush();
@ -3740,7 +3740,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
for (; map_size > 0;
pa += PAGE_SIZE, va += PAGE_SIZE, map_size -= PAGE_SIZE)
pmap_kenter_pa(va, pa | pmap_flags,
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
return 0;

View File

@ -1,5 +1,5 @@
/* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */
/* $OpenBSD: mem.c,v 1.40 2014/09/14 14:17:23 jsg Exp $ */
/* $OpenBSD: mem.c,v 1.41 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@ -147,7 +147,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
v = uio->uio_offset;
pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
trunc_page(v), uio->uio_rw == UIO_READ ?
VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED);
PROT_READ : PROT_WRITE, PMAP_WIRED);
pmap_update(pmap_kernel());
o = uio->uio_offset & PGOFSET;
c = min(uio->uio_resid, (int)(NBPG - o));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mpbios.c,v 1.35 2014/05/26 19:03:28 kettenis Exp $ */
/* $OpenBSD: mpbios.c,v 1.36 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */
/*-
@ -267,7 +267,7 @@ mpbios_map(paddr_t pa, int len, struct mp_map *handle)
handle->vsize = endpa - pgpa;
do {
pmap_kenter_pa(va, pgpa, VM_PROT_READ);
pmap_kenter_pa(va, pgpa, PROT_READ);
va += PAGE_SIZE;
pgpa += PAGE_SIZE;
} while (pgpa < endpa);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.160 2014/07/11 16:35:40 jsg Exp $ */
/* $OpenBSD: pmap.c,v 1.161 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@ -605,7 +605,7 @@ pmap_exec_fixup(struct vm_map *map, struct trapframe *tf, struct pcb *pcb)
vm_map_lock(map);
RB_FOREACH_REVERSE(ent, uvm_map_addr, &map->addr) {
if (ent->protection & VM_PROT_EXECUTE)
if (ent->protection & PROT_EXEC)
break;
}
/*
@ -696,7 +696,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
pt_entry_t *pte, opte, npte;
pte = vtopte(va);
npte = (pa & PMAP_PA_MASK) | ((prot & VM_PROT_WRITE)? PG_RW : PG_RO) |
npte = (pa & PMAP_PA_MASK) | ((prot & PROT_WRITE)? PG_RW : PG_RO) |
PG_V | PG_U | PG_M | ((pa & PMAP_NOCACHE) ? PG_N : 0) |
((pa & PMAP_WC) ? pmap_pg_wc : 0);
@ -795,14 +795,14 @@ pmap_bootstrap(vaddr_t kva_start)
* we can jam into a i386 PTE.
*/
protection_codes[UVM_PROT_NONE] = 0; /* --- */
protection_codes[UVM_PROT_EXEC] = PG_X; /* --x */
protection_codes[UVM_PROT_READ] = PG_RO; /* -r- */
protection_codes[UVM_PROT_RX] = PG_X; /* -rx */
protection_codes[UVM_PROT_WRITE] = PG_RW; /* w-- */
protection_codes[UVM_PROT_WX] = PG_RW|PG_X; /* w-x */
protection_codes[UVM_PROT_RW] = PG_RW; /* wr- */
protection_codes[UVM_PROT_RWX] = PG_RW|PG_X; /* wrx */
protection_codes[PROT_NONE] = 0; /* --- */
protection_codes[PROT_EXEC] = PG_X; /* --x */
protection_codes[PROT_READ] = PG_RO; /* -r- */
protection_codes[PROT_READ | PROT_EXEC] = PG_X; /* -rx */
protection_codes[PROT_WRITE] = PG_RW; /* w-- */
protection_codes[PROT_WRITE | PROT_EXEC] = PG_RW|PG_X; /* w-x */
protection_codes[PROT_READ | PROT_WRITE] = PG_RW; /* wr- */
protection_codes[PROT_READ | PROT_WRITE | PROT_EXEC] = PG_RW|PG_X; /* wrx */
/*
* now we init the kernel's pmap
@ -1122,7 +1122,7 @@ pmap_alloc_pvpage(struct pmap *pmap, int mode)
*/
pmap_kenter_pa(pv_cachedva, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ|VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
pvpage = (struct pv_page *) pv_cachedva;
pv_cachedva = 0;
return (pmap_add_pvpage(pvpage, mode != ALLOCPV_NONEED));
@ -2594,9 +2594,9 @@ enter_now:
npte |= PG_RW; /* XXXCDC: no longer needed? */
if (pmap == pmap_kernel())
npte |= pmap_pg_g;
if (flags & VM_PROT_READ)
if (flags & PROT_READ)
npte |= PG_U;
if (flags & VM_PROT_WRITE)
if (flags & PROT_WRITE)
npte |= PG_M;
if (pg) {
npte |= PG_PVLIST;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.117 2014/07/09 07:29:00 guenther Exp $ */
/* $OpenBSD: trap.c,v 1.118 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@ -138,10 +138,10 @@ trap(struct trapframe *frame)
/* SIGSEGV and SIGBUS need this */
if (frame->tf_err & PGEX_W) {
vftype = VM_PROT_WRITE;
ftype = VM_PROT_READ | VM_PROT_WRITE;
vftype = PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
} else
ftype = vftype = VM_PROT_READ;
ftype = vftype = PROT_READ;
#ifdef DEBUG
if (trapdebug) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.60 2013/01/16 19:04:43 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.61 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */
/*-
@ -232,7 +232,7 @@ vmapbuf(struct buf *bp, vsize_t len)
while (len) {
pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &fpa);
pmap_kenter_pa(taddr, fpa, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(taddr, fpa, PROT_READ | PROT_WRITE);
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
len -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.h,v 1.65 2014/07/11 16:35:40 jsg Exp $ */
/* $OpenBSD: pmap.h,v 1.66 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */
/*
@ -34,6 +34,7 @@
#define _MACHINE_PMAP_H_
#ifdef _KERNEL
#include <sys/mman.h>
#include <machine/cpufunc.h>
#include <machine/segments.h>
#endif
@ -435,8 +436,8 @@ boolean_t pmap_zero_page_uncached(paddr_t);
__inline static void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
if ((prot & VM_PROT_WRITE) == 0) {
if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC)) {
(void) pmap_clear_attrs(pg, PG_RW);
} else {
pmap_page_remove(pg);
@ -455,8 +456,8 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
__inline static void
pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
if ((prot & VM_PROT_WRITE) == 0) {
if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
if ((prot & PROT_WRITE) == 0) {
if (prot & (PROT_READ | PROT_EXEC)) {
pmap_write_protect(pmap, sva, eva, prot);
} else {
pmap_remove(pmap, sva, eva);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: agp_machdep.c,v 1.19 2014/09/20 16:15:16 kettenis Exp $ */
/* $OpenBSD: agp_machdep.c,v 1.20 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2008 - 2009 Owain G. Ainsworth <oga@openbsd.org>
@ -157,7 +157,7 @@ agp_map_atomic(struct agp_map *map, bus_size_t offset,
pmap_flags = PMAP_WC;
pa = bus_space_mmap(map->bst, map->addr, offset, 0, 0);
pmap_kenter_pa(map->va, pa | pmap_flags, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(map->va, pa | pmap_flags, PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
*bshp = (bus_space_handle_t)map->va;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vga_post.c,v 1.7 2014/07/12 18:44:42 tedu Exp $ */
/* $OpenBSD: vga_post.c,v 1.8 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: vga_post.c,v 1.12 2009/03/15 21:32:36 cegger Exp $ */
/*-
@ -149,7 +149,7 @@ vga_post_init(int bus, int device, int function)
sc->sys_image = sys_image;
sc->emu.sys_private = sc;
pmap_kenter_pa(sys_bios_data, 0, VM_PROT_READ);
pmap_kenter_pa(sys_bios_data, 0, PROT_READ);
pmap_update(pmap_kernel());
memcpy((void *)sc->bios_data, (void *)sys_bios_data, PAGE_SIZE);
pmap_kremove(sys_bios_data, PAGE_SIZE);
@ -158,14 +158,14 @@ vga_post_init(int bus, int device, int function)
iter = 0;
TAILQ_FOREACH(pg, &sc->ram_backing, pageq) {
pmap_kenter_pa(sc->sys_image + iter, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
iter += PAGE_SIZE;
}
KASSERT(iter == BASE_MEMORY);
for (iter = 640 * 1024; iter < 1024 * 1024; iter += PAGE_SIZE)
pmap_kenter_pa(sc->sys_image + iter, iter,
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
memset(&sc->emu, 0, sizeof(sc->emu));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: obio.c,v 1.8 2010/04/04 12:49:30 miod Exp $ */
/* $OpenBSD: obio.c,v 1.9 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: obio.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@ -269,7 +269,7 @@ obio_iomem_add_mapping(bus_addr_t bpa, bus_size_t size, int type,
#undef MODE
for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
pte = __pmap_kpte_lookup(va);
KDASSERT(pte);
*pte |= m; /* PTEA PCMCIA assistant bit */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.11 2014/07/12 18:44:42 tedu Exp $ */
/* $OpenBSD: bus_dma.c,v 1.12 2014/11/16 12:30:57 deraadt Exp $ */
/* $NetBSD: bus_dma.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*
@ -662,7 +662,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
if (size == 0)
panic("_bus_dmamem_map: size botch");
pmap_kenter_pa(va, addr,
VM_PROT_READ | VM_PROT_WRITE);
PROT_READ | PROT_WRITE);
}
}
pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.17 2014/09/26 14:32:07 jsing Exp $ */
/* $OpenBSD: bus_dma.c,v 1.18 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@ -464,8 +464,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
panic("_dmamem_map: size botch");
pa = (*t->_device_to_pa)(addr);
error = pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ |
VM_PROT_WRITE | pmap_flags);
PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | pmap_flags);
if (error) {
pmap_update(pmap_kernel());
km_free((void *)sva, ssize, &kv_any, &kp_none);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap_table.c,v 1.11 2014/04/16 12:01:33 aoyama Exp $ */
/* $OpenBSD: pmap_table.c,v 1.12 2014/11/16 12:30:57 deraadt Exp $ */
/*
* Mach Operating System
@ -34,8 +34,8 @@
#include <machine/board.h>
#include <machine/pmap_table.h>
#define R VM_PROT_READ
#define RW (VM_PROT_READ | VM_PROT_WRITE)
#define R PROT_READ
#define RW (PROT_READ | PROT_WRITE)
#define CW CACHE_WT
#define CI CACHE_INH
#define CG CACHE_GLOBAL

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.78 2014/06/09 14:33:20 miod Exp $ */
/* $OpenBSD: pmap.c,v 1.79 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2001-2004, 2010, Miodrag Vallat.
@ -179,7 +179,7 @@ pg_to_pvh(struct vm_page *pg)
* PTE routines
*/
#define m88k_protection(prot) ((prot) & VM_PROT_WRITE ? PG_RW : PG_RO)
#define m88k_protection(prot) ((prot) & PROT_WRITE ? PG_RW : PG_RO)
#define pmap_pte_w(pte) (*(pte) & PG_W)
#define SDTENT(pm, va) ((pm)->pm_stab + SDTIDX(va))
@ -617,7 +617,7 @@ pmap_map(paddr_t pa, psize_t sz, vm_prot_t prot, u_int cmode,
pa = trunc_batc(pa);
batc = BATC_SO | BATC_V;
if ((prot & VM_PROT_WRITE) == 0)
if ((prot & PROT_WRITE) == 0)
batc |= BATC_PROT;
if (cmode & CACHE_INH)
batc |= BATC_INH;
@ -791,7 +791,8 @@ pmap_bootstrap(paddr_t s_rom, paddr_t e_rom)
if (e_rom != s_rom) {
s_firmware = s_rom;
l_firmware = e_rom - s_rom;
pmap_map(s_firmware, l_firmware, UVM_PROT_RW, CACHE_INH, FALSE);
pmap_map(s_firmware, l_firmware, PROT_READ | PROT_WRITE,
CACHE_INH, FALSE);
}
for (ptable = pmap_table_build(); ptable->size != (vsize_t)-1; ptable++)
@ -1099,7 +1100,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
if (wired)
npte |= PG_W;
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
/*
* On 88110, do not mark writable mappings as dirty unless we
* know the page is dirty, or we are using the kernel pmap.
@ -1109,7 +1110,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
npte |= PG_U;
else
npte |= PG_M_U;
} else if (prot & VM_PROT_ALL)
} else if (prot & PROT_MASK)
npte |= PG_U;
/*
@ -1133,12 +1134,12 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* Cache attribute flags
*/
if (pvl != NULL) {
if (flags & VM_PROT_WRITE) {
if (flags & PROT_WRITE) {
if (CPU_IS88110 && pmap != pmap_kernel())
pvl->pv_flags |= PG_U;
else
pvl->pv_flags |= PG_M_U;
} else if (flags & VM_PROT_ALL)
} else if (flags & PROT_MASK)
pvl->pv_flags |= PG_U;
}
@ -1439,7 +1440,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
pt_entry_t *pte, ap, opte, npte;
vaddr_t va, eseg;
if ((prot & VM_PROT_READ) == 0) {
if ((prot & PROT_READ) == 0) {
pmap_remove(pmap, sva, eva);
return;
}
@ -1783,9 +1784,9 @@ pmap_is_referenced(struct vm_page *pg)
void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
if ((prot & VM_PROT_READ) == VM_PROT_NONE)
if ((prot & PROT_READ) == PROT_NONE)
pmap_remove_page(pg);
else if ((prot & VM_PROT_WRITE) == VM_PROT_NONE)
else if ((prot & PROT_WRITE) == PROT_NONE)
pmap_changebit(pg, PG_RO, ~0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.100 2014/07/02 18:37:34 miod Exp $ */
/* $OpenBSD: trap.c,v 1.101 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@ -295,11 +295,11 @@ lose:
fault_addr = frame->tf_dma0;
if (frame->tf_dmt0 & (DMT_WRITE|DMT_LOCKBAR)) {
ftype = VM_PROT_READ|VM_PROT_WRITE;
fault_code = VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
fault_code = PROT_WRITE;
} else {
ftype = VM_PROT_READ;
fault_code = VM_PROT_READ;
ftype = PROT_READ;
fault_code = PROT_READ;
}
va = trunc_page((vaddr_t)fault_addr);
@ -399,11 +399,11 @@ user_fault:
}
if (frame->tf_dmt0 & (DMT_WRITE | DMT_LOCKBAR)) {
ftype = VM_PROT_READ | VM_PROT_WRITE;
fault_code = VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
fault_code = PROT_WRITE;
} else {
ftype = VM_PROT_READ;
fault_code = VM_PROT_READ;
ftype = PROT_READ;
fault_code = PROT_READ;
}
va = trunc_page((vaddr_t)fault_addr);
@ -813,11 +813,11 @@ lose:
fault_addr = frame->tf_dlar;
if (frame->tf_dsr & CMMU_DSR_RW) {
ftype = VM_PROT_READ;
fault_code = VM_PROT_READ;
ftype = PROT_READ;
fault_code = PROT_READ;
} else {
ftype = VM_PROT_READ|VM_PROT_WRITE;
fault_code = VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
fault_code = PROT_WRITE;
}
va = trunc_page((vaddr_t)fault_addr);
@ -860,8 +860,8 @@ lose:
KERNEL_LOCK();
m88110_user_fault:
if (type == T_INSTFLT+T_USER) {
ftype = VM_PROT_READ;
fault_code = VM_PROT_READ;
ftype = PROT_READ;
fault_code = PROT_READ;
#ifdef TRAPDEBUG
printf("User Instruction fault exip %x isr %x ilar %x\n",
frame->tf_exip, frame->tf_isr, frame->tf_ilar);
@ -869,11 +869,11 @@ m88110_user_fault:
} else {
fault_addr = frame->tf_dlar;
if (frame->tf_dsr & CMMU_DSR_RW) {
ftype = VM_PROT_READ;
fault_code = VM_PROT_READ;
ftype = PROT_READ;
fault_code = PROT_READ;
} else {
ftype = VM_PROT_READ|VM_PROT_WRITE;
fault_code = VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
fault_code = PROT_WRITE;
}
#ifdef TRAPDEBUG
printf("User Data access fault exip %x dsr %x dlar %x\n",

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.22 2013/01/16 19:04:43 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.23 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
@ -205,8 +205,8 @@ vmapbuf(bp, len)
if (pmap_extract(pmap, (vaddr_t)addr, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(vm_map_pmap(phys_map), kva, 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);
addr += PAGE_SIZE;
kva += PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dma.c,v 1.40 2014/07/12 18:44:42 tedu Exp $ */
/* $OpenBSD: dma.c,v 1.41 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@ -485,8 +485,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
if (size == 0)
panic("_bus_dmamem_map: size botch");
error = pmap_enter(pmap_kernel(), va, addr | pmapflags,
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);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.163 2014/10/27 21:56:57 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.164 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@ -765,7 +765,7 @@ dumpsys()
(ptoa(dumpsize) - maddr) / (1024 * 1024));
pmap_enter(pmap_kernel(), dumpspace, maddr,
VM_PROT_READ, PMAP_WIRED);
PROT_READ, PMAP_WIRED);
if ((error = (*dump)(dumpdev, blkno,
(caddr_t)dumpspace, PAGE_SIZE)) != 0)
break;
@ -1085,7 +1085,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
bpa, size, *bshp, spa);
#endif
for (; len > 0; len -= PAGE_SIZE) {
pmap_kenter_cache(vaddr, spa, VM_PROT_READ | VM_PROT_WRITE,
pmap_kenter_cache(vaddr, spa, PROT_READ | PROT_WRITE,
(flags & BUS_SPACE_MAP_CACHEABLE) ?
PMAP_CACHE_WT : PMAP_CACHE_CI);
spa += PAGE_SIZE;
@ -1137,7 +1137,7 @@ mapiodev(paddr_t pa, psize_t len)
for (vaddr = va; size > 0; size -= PAGE_SIZE) {
pmap_kenter_cache(vaddr, spa,
VM_PROT_READ | VM_PROT_WRITE, PMAP_CACHE_DEFAULT);
PROT_READ | PROT_WRITE, PMAP_CACHE_DEFAULT);
spa += PAGE_SIZE;
vaddr += PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mips64_machdep.c,v 1.16 2014/08/12 04:28:07 miod Exp $ */
/* $OpenBSD: mips64_machdep.c,v 1.17 2014/11/16 12:30:58 deraadt 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(UVM_PROT_NONE, UVM_PROT_ALL, UVM_INH_COPY,
UVM_MAPFLAG(PROT_NONE, PROT_MASK, UVM_INH_COPY,
UVM_ADV_NORMAL, UVM_FLAG_COPYONW));
if (rc != 0)
return rc;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.76 2014/09/30 06:51:58 jmatthew Exp $ */
/* $OpenBSD: pmap.c,v 1.77 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@ -739,7 +739,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
vaddr_t va;
int s;
if (prot == VM_PROT_NONE) {
if (prot == PROT_NONE) {
DPRINTF(PDB_REMOVE, ("pmap_page_protect(%p, 0x%x)\n", pg, prot));
} else {
DPRINTF(PDB_FOLLOW|PDB_PROTECT,
@ -747,13 +747,13 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
}
switch (prot) {
case VM_PROT_READ|VM_PROT_WRITE:
case VM_PROT_ALL:
case PROT_READ | PROT_WRITE:
case PROT_MASK:
break;
/* copy_on_write */
case VM_PROT_READ:
case VM_PROT_READ|VM_PROT_EXECUTE:
case PROT_READ:
case PROT_READ | PROT_EXEC:
pv = pg_to_pvh(pg);
s = splvm();
/*
@ -796,12 +796,12 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
("pmap_protect(%p, %p, %p, 0x%x)\n",
pmap, (void *)sva, (void *)eva, prot));
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
if ((prot & PROT_READ) == PROT_NONE) {
pmap_remove(pmap, sva, eva);
return;
}
p = (prot & VM_PROT_WRITE) ? PG_M : PG_RO;
p = (prot & PROT_WRITE) ? PG_M : PG_RO;
if (pmap == pmap_kernel()) {
/*
@ -909,7 +909,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
pg = PHYS_TO_VM_PAGE(pa);
if (pg != NULL) {
if (!(prot & VM_PROT_WRITE)) {
if (!(prot & PROT_WRITE)) {
npte = PG_ROPAGE;
} else {
if (pmap == pmap_kernel()) {
@ -932,10 +932,10 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
}
/* Set page referenced/modified status based on flags */
if (flags & VM_PROT_WRITE)
if (flags & PROT_WRITE)
atomic_setbits_int(&pg->pg_flags,
PGF_ATTR_MOD | PGF_ATTR_REF);
else if (flags & VM_PROT_ALL)
else if (flags & PROT_MASK)
atomic_setbits_int(&pg->pg_flags, PGF_ATTR_REF);
stat_count(enter_stats.managed);
@ -945,7 +945,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* then it must be device memory which may be volatile.
*/
stat_count(enter_stats.unmanaged);
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
npte = PG_IOPAGE & ~PG_G;
} else {
npte = (PG_IOPAGE | PG_RO) & ~(PG_G | PG_M);
@ -1052,7 +1052,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* flag it in the pte.
*/
if (r4000_errata != 0) {
if (pg != NULL && (prot & VM_PROT_EXECUTE)) {
if (pg != NULL && (prot & PROT_EXEC)) {
if ((pg->pg_flags & PGF_EOP_CHECKED) == 0)
atomic_setbits_int(&pg->pg_flags,
PGF_EOP_CHECKED |
@ -1070,7 +1070,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
/*
* If mapping an executable page, invalidate ICache.
*/
if (pg != NULL && (prot & VM_PROT_EXECUTE))
if (pg != NULL && (prot & PROT_EXEC))
Mips_InvalidateICache(ci, va, PAGE_SIZE);
return 0;
@ -1091,7 +1091,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
#endif
npte = vad_to_pfn(pa) | PG_G | PG_WIRED;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
npte |= PG_RWPAGE;
else
npte |= PG_ROPAGE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: r4000_errata.c,v 1.4 2014/04/04 20:52:05 miod Exp $ */
/* $OpenBSD: r4000_errata.c,v 1.5 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2014 Miodrag Vallat.
@ -215,7 +215,7 @@ eop_tlb_miss_handler(struct trap_frame *trapframe, struct cpu_info *ci,
onfault = pcb->pcb_onfault;
pcb->pcb_onfault = 0;
KERNEL_LOCK();
(void)uvm_fault(map, va, 0, VM_PROT_READ | VM_PROT_EXECUTE);
(void)uvm_fault(map, va, 0, PROT_READ | PROT_EXEC);
KERNEL_UNLOCK();
pcb->pcb_onfault = onfault;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.101 2014/09/30 06:51:58 jmatthew Exp $ */
/* $OpenBSD: trap.c,v 1.102 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -283,7 +283,7 @@ itsa(struct trap_frame *trapframe, struct cpu_info *ci, struct proc *p,
if (pmap_is_page_ro(pmap_kernel(),
trunc_page(trapframe->badvaddr), entry)) {
/* write to read only page in the kernel */
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
pcb = &p->p_addr->u_pcb;
goto kernel_fault;
}
@ -320,7 +320,7 @@ itsa(struct trap_frame *trapframe, struct cpu_info *ci, struct proc *p,
if (pmap_is_page_ro(pmap,
trunc_page(trapframe->badvaddr), entry)) {
/* write to read only page */
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
pcb = &p->p_addr->u_pcb;
goto fault_common_no_miss;
}
@ -340,7 +340,7 @@ itsa(struct trap_frame *trapframe, struct cpu_info *ci, struct proc *p,
case T_TLB_LD_MISS:
case T_TLB_ST_MISS:
ftype = (type == T_TLB_ST_MISS) ? VM_PROT_WRITE : VM_PROT_READ;
ftype = (type == T_TLB_ST_MISS) ? PROT_WRITE : PROT_READ;
pcb = &p->p_addr->u_pcb;
/* check for kernel address */
if (trapframe->badvaddr < 0) {
@ -379,12 +379,12 @@ itsa(struct trap_frame *trapframe, struct cpu_info *ci, struct proc *p,
}
case T_TLB_LD_MISS+T_USER:
ftype = VM_PROT_READ;
ftype = PROT_READ;
pcb = &p->p_addr->u_pcb;
goto fault_common;
case T_TLB_ST_MISS+T_USER:
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
pcb = &p->p_addr->u_pcb;
fault_common:
@ -453,13 +453,13 @@ fault_common_no_miss:
case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */
case T_ADDR_ERR_ST+T_USER: /* misaligned or kseg access */
ucode = 0; /* XXX should be VM_PROT_something */
ucode = 0; /* XXX should be PROT_something */
i = SIGBUS;
typ = BUS_ADRALN;
break;
case T_BUS_ERR_IFETCH+T_USER: /* BERR asserted to cpu */
case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to cpu */
ucode = 0; /* XXX should be VM_PROT_something */
ucode = 0; /* XXX should be PROT_something */
i = SIGBUS;
typ = BUS_OBJERR;
break;
@ -659,7 +659,7 @@ fault_common_no_miss:
p->p_md.md_fppgva + PAGE_SIZE);
(void)uvm_map_protect(map, p->p_md.md_fppgva,
p->p_md.md_fppgva + PAGE_SIZE,
UVM_PROT_NONE, FALSE);
PROT_NONE, FALSE);
return;
}
/* FALLTHROUGH */
@ -1498,7 +1498,7 @@ fpe_branch_emulate(struct proc *p, struct trap_frame *tf, uint32_t insn,
*/
rc = uvm_map_protect(map, p->p_md.md_fppgva,
p->p_md.md_fppgva + PAGE_SIZE, UVM_PROT_RWX, FALSE);
p->p_md.md_fppgva + PAGE_SIZE, PROT_MASK, FALSE);
if (rc != 0) {
#ifdef DEBUG
printf("%s: uvm_map_protect on %p failed: %d\n",
@ -1507,7 +1507,7 @@ fpe_branch_emulate(struct proc *p, struct trap_frame *tf, uint32_t insn,
return rc;
}
rc = uvm_fault_wire(map, p->p_md.md_fppgva,
p->p_md.md_fppgva + PAGE_SIZE, UVM_PROT_RWX);
p->p_md.md_fppgva + PAGE_SIZE, PROT_MASK);
if (rc != 0) {
#ifdef DEBUG
printf("%s: uvm_fault_wire on %p failed: %d\n",
@ -1535,7 +1535,7 @@ fpe_branch_emulate(struct proc *p, struct trap_frame *tf, uint32_t insn,
}
(void)uvm_map_protect(map, p->p_md.md_fppgva,
p->p_md.md_fppgva + PAGE_SIZE, UVM_PROT_RX, FALSE);
p->p_md.md_fppgva + PAGE_SIZE, PROT_READ | PROT_EXEC, FALSE);
p->p_md.md_fpbranchva = dest;
p->p_md.md_fpslotva = (vaddr_t)tf->pc + 4;
p->p_md.md_flags |= MDP_FPUSED;
@ -1548,7 +1548,7 @@ err:
uvm_fault_unwire(map, p->p_md.md_fppgva, p->p_md.md_fppgva + PAGE_SIZE);
err2:
(void)uvm_map_protect(map, p->p_md.md_fppgva,
p->p_md.md_fppgva + PAGE_SIZE, UVM_PROT_NONE, FALSE);
p->p_md.md_fppgva + PAGE_SIZE, PROT_NONE, FALSE);
return rc;
}
#endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.29 2014/05/10 22:25:16 jasper Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.30 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
@ -245,8 +245,8 @@ vmapbuf(bp, len)
pmap, uva);
pmap_enter(vm_map_pmap(phys_map), kva, 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);
uva += PAGE_SIZE;
kva += PAGE_SIZE;
sz -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.13 2014/09/13 16:06:36 doug Exp $ */
/* $OpenBSD: bus_dma.c,v 1.14 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@ -457,8 +457,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
panic("_dmamem_map: size botch");
pa = (*t->_device_to_pa)(addr);
error = pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ |
VM_PROT_WRITE | pmap_flags);
PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | pmap_flags);
if (error) {
pmap_update(pmap_kernel());
km_free((void *)sva, ssize, &kv_any, &kp_none);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.131 2014/11/02 00:11:32 kettenis Exp $ */
/* $OpenBSD: pmap.c,v 1.132 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2001, 2002, 2007 Dale Rahn.
@ -616,7 +616,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
else
pte_insert32(pted);
if (prot & VM_PROT_EXECUTE) {
if (prot & PROT_EXEC) {
u_int sn = VP_SR(va);
pm->pm_exec[sn]++;
@ -625,7 +625,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
if (pg != NULL) {
need_sync = ((pg->pg_flags & PG_PMAP_EXE) == 0);
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
atomic_clearbits_int(&pg->pg_flags,
PG_PMAP_EXE);
else
@ -638,7 +638,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
* Should we be paranoid about writeable non-exec
* mappings ? if so, clear the exec tag
*/
if ((prot & VM_PROT_WRITE) && (pg != NULL))
if ((prot & PROT_WRITE) && (pg != NULL))
atomic_clearbits_int(&pg->pg_flags, PG_PMAP_EXE);
}
@ -794,7 +794,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
pmap_kremove_pg(va); /* pted is reused */
pm->pm_stats.resident_count++;
if (prot & VM_PROT_WRITE) {
if (prot & PROT_WRITE) {
pg = PHYS_TO_VM_PAGE(pa);
if (pg != NULL)
atomic_clearbits_int(&pg->pg_flags, PG_PMAP_EXE);
@ -832,7 +832,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
pted->pted_va |= PTED_VA_WIRED_M;
if (prot & VM_PROT_EXECUTE) {
if (prot & PROT_EXEC) {
u_int sn = VP_SR(va);
pm->pm_exec[sn]++;
@ -1030,14 +1030,14 @@ pmap_fill_pte64(pmap_t pm, vaddr_t va, paddr_t pa, struct pte_desc *pted,
else
pte64->pte_lo |= (PTE_M_64 | PTE_I_64 | PTE_G_64);
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
pte64->pte_lo |= PTE_RW_64;
else
pte64->pte_lo |= PTE_RO_64;
pted->pted_va = va & ~PAGE_MASK;
if (prot & VM_PROT_EXECUTE)
if (prot & PROT_EXEC)
pted->pted_va |= PTED_VA_EXEC_M;
else
pte64->pte_lo |= PTE_N_64;
@ -1068,7 +1068,7 @@ pmap_fill_pte32(pmap_t pm, vaddr_t va, paddr_t pa, struct pte_desc *pted,
else
pte32->pte_lo |= (PTE_M_32 | PTE_I_32 | PTE_G_32);
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
pte32->pte_lo |= PTE_RW_32;
else
pte32->pte_lo |= PTE_RO_32;
@ -1076,7 +1076,7 @@ pmap_fill_pte32(pmap_t pm, vaddr_t va, paddr_t pa, struct pte_desc *pted,
pted->pted_va = va & ~PAGE_MASK;
/* XXX Per-page execution control. */
if (prot & VM_PROT_EXECUTE)
if (prot & PROT_EXEC)
pted->pted_va |= PTED_VA_EXEC_M;
pted->pted_pmap = pm;
@ -1227,7 +1227,7 @@ pmap_zero_page(struct vm_page *pg)
#endif
/* simple_lock(&pmap_zero_page_lock); */
pmap_kenter_pa(zero_page, pa, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(zero_page, pa, PROT_READ | PROT_WRITE);
#ifdef USE_DCBZ
for (i = PAGE_SIZE/CACHELINESIZE; i>0; i--) {
__asm volatile ("dcbz 0,%0" :: "r"(addr));
@ -1251,8 +1251,8 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg);
/* simple_lock(&pmap_copy_page_lock); */
pmap_kenter_pa(copy_src_page, srcpa, VM_PROT_READ);
pmap_kenter_pa(copy_dst_page, dstpa, VM_PROT_READ|VM_PROT_WRITE);
pmap_kenter_pa(copy_src_page, srcpa, PROT_READ);
pmap_kenter_pa(copy_dst_page, dstpa, PROT_READ | PROT_WRITE);
bcopy((void *)copy_src_page, (void *)copy_dst_page, PAGE_SIZE);
@ -2054,7 +2054,7 @@ pmap_page_ro64(pmap_t pm, vaddr_t va, vm_prot_t prot)
pg = PHYS_TO_VM_PAGE(pted->p.pted_pte64.pte_lo & PTE_RPGN_64);
if (pg->pg_flags & PG_PMAP_EXE) {
if ((prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)) == VM_PROT_WRITE) {
if ((prot & (PROT_WRITE | PROT_EXEC)) == PROT_WRITE) {
atomic_clearbits_int(&pg->pg_flags, PG_PMAP_EXE);
} else {
pmap_syncicache_user_virt(pm, va);
@ -2064,7 +2064,7 @@ pmap_page_ro64(pmap_t pm, vaddr_t va, vm_prot_t prot)
pted->p.pted_pte64.pte_lo &= ~PTE_PP_64;
pted->p.pted_pte64.pte_lo |= PTE_RO_64;
if ((prot & VM_PROT_EXECUTE) == 0)
if ((prot & PROT_EXEC) == 0)
pted->p.pted_pte64.pte_lo |= PTE_N_64;
sr = ptesr(pm->pm_sr, va);
@ -2113,7 +2113,7 @@ pmap_page_ro32(pmap_t pm, vaddr_t va, vm_prot_t prot)
pg = PHYS_TO_VM_PAGE(pted->p.pted_pte32.pte_lo & PTE_RPGN_32);
if (pg->pg_flags & PG_PMAP_EXE) {
if ((prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)) == VM_PROT_WRITE) {
if ((prot & (PROT_WRITE | PROT_EXEC)) == PROT_WRITE) {
atomic_clearbits_int(&pg->pg_flags, PG_PMAP_EXE);
} else {
pmap_syncicache_user_virt(pm, va);
@ -2170,7 +2170,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
/* need to lock for this pv */
s = splvm();
if (prot == VM_PROT_NONE) {
if (prot == PROT_NONE) {
while (!LIST_EMPTY(&(pg->mdpage.pv_list))) {
pted = LIST_FIRST(&(pg->mdpage.pv_list));
pmap_remove_pg(pted->pted_pmap, pted->pted_va);
@ -2194,7 +2194,7 @@ void
pmap_protect(pmap_t pm, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
int s;
if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) {
if (prot & (PROT_READ | PROT_EXEC)) {
s = splvm();
if (ppc_proc_is_64b) {
while (sva < eva) {
@ -2302,7 +2302,7 @@ pte_spill_r(u_int32_t va, u_int32_t msr, u_int32_t dsisr, int exec_fault)
/* 0 - physmaxaddr mapped 1-1 */
if (va < physmaxaddr) {
u_int32_t aligned_va;
vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
vm_prot_t prot = PROT_READ | PROT_WRITE;
extern caddr_t kernel_text;
extern caddr_t etext;
@ -2310,7 +2310,7 @@ pte_spill_r(u_int32_t va, u_int32_t msr, u_int32_t dsisr, int exec_fault)
if (va >= trunc_page((vaddr_t)&kernel_text) &&
va < round_page((vaddr_t)&etext)) {
prot |= VM_PROT_EXECUTE;
prot |= PROT_EXEC;
}
aligned_va = trunc_page(va);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.102 2014/09/06 09:42:23 mpi Exp $ */
/* $OpenBSD: trap.c,v 1.103 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@ -289,9 +289,9 @@ trap(struct trapframe *frame)
return;
}
if (frame->dsisr & DSISR_STORE)
ftype = VM_PROT_READ | VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
else
ftype = VM_PROT_READ;
ftype = PROT_READ;
KERNEL_LOCK();
if (uvm_fault(map, trunc_page(va), 0, ftype) == 0) {
KERNEL_UNLOCK();
@ -323,10 +323,10 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0);
KERNEL_LOCK();
if (frame->dsisr & DSISR_STORE) {
ftype = VM_PROT_READ | VM_PROT_WRITE;
vftype = VM_PROT_WRITE;
ftype = PROT_READ | PROT_WRITE;
vftype = PROT_WRITE;
} else
vftype = ftype = VM_PROT_READ;
vftype = ftype = PROT_READ;
if (uvm_fault(&p->p_vmspace->vm_map,
trunc_page(frame->dar), 0, ftype) == 0) {
uvm_grow(p, trunc_page(frame->dar));
@ -355,7 +355,7 @@ printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr);
break;
KERNEL_LOCK();
ftype = VM_PROT_READ | VM_PROT_EXECUTE;
ftype = PROT_READ | PROT_EXEC;
if (uvm_fault(&p->p_vmspace->vm_map,
trunc_page(frame->srr0), 0, ftype) == 0) {
uvm_grow(p, trunc_page(frame->srr0));
@ -373,7 +373,7 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
/* XXX Have to make sure that sigreturn does the right thing. */
sv.sival_int = frame->srr0;
KERNEL_LOCK();
trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv);
trapsignal(p, SIGSEGV, PROT_EXEC, SEGV_MAPERR, sv);
KERNEL_UNLOCK();
break;
case EXC_SC|EXC_USER:
@ -483,7 +483,7 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
else {
sv.sival_int = frame->srr0;
KERNEL_LOCK();
trapsignal(p, SIGBUS, VM_PROT_EXECUTE, BUS_ADRALN,
trapsignal(p, SIGBUS, PROT_EXEC, BUS_ADRALN,
sv);
KERNEL_UNLOCK();
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.46 2013/01/16 19:04:43 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.47 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
@ -217,7 +217,7 @@ vmapbuf(struct buf *bp, vsize_t len)
pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &pa);
pmap_enter(vm_map_pmap(phys_map), taddr, pa,
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
PROT_READ | PROT_WRITE, PMAP_WIRED);
faddr += NBPG;
taddr += NBPG;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.38 2014/09/13 16:06:37 doug Exp $ */
/* $OpenBSD: bus_dma.c,v 1.39 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@ -505,8 +505,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
#endif
pa = (*t->_device_to_pa)(addr);
error = pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ |
VM_PROT_WRITE | pmap_flags);
PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | pmap_flags);
if (error) {
pmap_update(pmap_kernel());
km_free((void *)sva, ssize, &kv_any, &kp_none);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.21 2014/01/20 21:19:28 guenther Exp $ */
/* $OpenBSD: pmap.c,v 1.22 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.55 2006/08/07 23:19:36 tsutsui Exp $ */
/*-
@ -296,7 +296,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
boolean_t kva = (pmap == pmap_kernel());
/* "flags" never exceed "prot" */
KDASSERT(prot != 0 && ((flags & VM_PROT_ALL) & ~prot) == 0);
KDASSERT(prot != 0 && ((flags & PROT_MASK) & ~prot) == 0);
pg = PHYS_TO_VM_PAGE(pa);
entry = (pa & PG_PPN) | PG_4K;
@ -308,16 +308,16 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
entry |= PG_C; /* always cached */
/* Modified/reference tracking */
if (flags & VM_PROT_WRITE) {
if (flags & PROT_WRITE) {
entry |= PG_V | PG_D;
pvh->pvh_flags |= PVH_MODIFIED | PVH_REFERENCED;
} else if (flags & VM_PROT_ALL) {
} else if (flags & PROT_MASK) {
entry |= PG_V;
pvh->pvh_flags |= PVH_REFERENCED;
}
/* Protection */
if ((prot & VM_PROT_WRITE) && (pvh->pvh_flags & PVH_MODIFIED)) {
if ((prot & PROT_WRITE) && (pvh->pvh_flags & PVH_MODIFIED)) {
if (kva)
entry |= PG_PR_KRW | PG_SH;
else
@ -343,11 +343,11 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
} else { /* bus-space (always uncached map) */
if (kva) {
entry |= PG_V | PG_SH |
((prot & VM_PROT_WRITE) ?
((prot & PROT_WRITE) ?
(PG_PR_KRW | PG_D) : PG_PR_KRO);
} else {
entry |= PG_V |
((prot & VM_PROT_WRITE) ?
((prot & PROT_WRITE) ?
(PG_PR_URW | PG_D) : PG_PR_URO);
}
}
@ -370,7 +370,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
sh_tlb_update(pmap->pm_asid, va, entry);
if (!SH_HAS_UNIFIED_CACHE &&
(prot == (VM_PROT_READ | VM_PROT_EXECUTE)))
(prot == (PROT_READ | PROT_EXEC)))
sh_icache_sync_range_index(va, PAGE_SIZE);
if (entry & _PG_WIRED)
@ -444,11 +444,11 @@ __pmap_pv_enter(pmap_t pmap, struct vm_page *pg, vaddr_t va, vm_prot_t prot)
if (SH_HAS_VIRTUAL_ALIAS) {
/* Remove all other mapping on this physical page */
pvh = &pg->mdpage;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
have_writeable = 1;
else {
SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) {
if (pv->pv_prot & VM_PROT_WRITE) {
if (pv->pv_prot & PROT_WRITE) {
have_writeable = 1;
break;
}
@ -557,7 +557,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
KDASSERT(va >= VM_MIN_KERNEL_ADDRESS && va < VM_MAX_KERNEL_ADDRESS);
entry = (pa & PG_PPN) | PG_V | PG_SH | PG_4K;
if (prot & VM_PROT_WRITE)
if (prot & PROT_WRITE)
entry |= (PG_PR_KRW | PG_D);
else
entry |= PG_PR_KRO;
@ -632,7 +632,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
sva = trunc_page(sva);
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
if ((prot & PROT_READ) == PROT_NONE) {
pmap_remove(pmap, sva, eva);
return;
}
@ -641,14 +641,14 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
default:
panic("pmap_protect: invalid protection mode %x", prot);
/* NOTREACHED */
case VM_PROT_READ:
case PROT_READ:
/* FALLTHROUGH */
case VM_PROT_READ | VM_PROT_EXECUTE:
case PROT_READ | PROT_EXEC:
protbits = kernel ? PG_PR_KRO : PG_PR_URO;
break;
case VM_PROT_READ | VM_PROT_WRITE:
case PROT_READ | PROT_WRITE:
/* FALLTHROUGH */
case VM_PROT_ALL:
case PROT_MASK:
protbits = kernel ? PG_PR_KRW : PG_PR_URW;
break;
}
@ -660,7 +660,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
continue;
if (SH_HAS_VIRTUAL_ALIAS && (entry & PG_D)) {
if (!SH_HAS_UNIFIED_CACHE && (prot & VM_PROT_EXECUTE))
if (!SH_HAS_UNIFIED_CACHE && (prot & PROT_EXEC))
sh_icache_sync_range_index(va, PAGE_SIZE);
else
sh_dcache_wbinv_range_index(va, PAGE_SIZE);
@ -711,14 +711,14 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
int s;
switch (prot) {
case VM_PROT_READ | VM_PROT_WRITE:
case PROT_READ | PROT_WRITE:
/* FALLTHROUGH */
case VM_PROT_ALL:
case PROT_MASK:
break;
case VM_PROT_READ:
case PROT_READ:
/* FALLTHROUGH */
case VM_PROT_READ | VM_PROT_EXECUTE:
case PROT_READ | PROT_EXEC:
s = splvm();
SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) {
pmap = pv->pv_pmap;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.31 2014/10/13 04:47:22 miod Exp $ */
/* $OpenBSD: trap.c,v 1.32 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@ -350,15 +350,15 @@ tlb_exception(struct proc *p, struct trapframe *tf, uint32_t va)
switch (tf->tf_expevt) {
case EXPEVT_TLB_MISS_LD:
track = PVH_REFERENCED;
ftype = VM_PROT_READ;
ftype = PROT_READ;
break;
case EXPEVT_TLB_MISS_ST:
track = PVH_REFERENCED;
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
break;
case EXPEVT_TLB_MOD:
track = PVH_REFERENCED | PVH_MODIFIED;
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
break;
case EXPEVT_TLB_PROT_LD:
TLB_ASSERT((int)va > 0,
@ -376,7 +376,7 @@ tlb_exception(struct proc *p, struct trapframe *tf, uint32_t va)
case EXPEVT_TLB_PROT_ST:
track = 0; /* call uvm_fault first. (COW) */
ftype = VM_PROT_WRITE;
ftype = PROT_WRITE;
break;
default:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vm_machdep.c,v 1.11 2013/01/16 19:04:43 miod Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.12 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.53 2006/08/31 16:49:21 matt Exp $ */
/*
@ -340,7 +340,7 @@ vmapbuf(struct buf *bp, vsize_t len)
while (len) {
pmap_extract(upmap, faddr, &fpa);
pmap_enter(kpmap, taddr, fpa,
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
PROT_READ | PROT_WRITE, PMAP_WIRED);
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
len -= PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dma.c,v 1.12 2014/07/12 18:44:42 tedu Exp $ */
/* $OpenBSD: dma.c,v 1.13 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@ -482,8 +482,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
if (size == 0)
panic("_bus_dmamem_map: size botch");
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);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.58 2014/10/27 21:56:57 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.59 2014/11/16 12:30:58 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@ -579,7 +579,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
bpa, size, *bshp, spa);
#endif
for (; len > 0; len -= PAGE_SIZE) {
pmap_kenter_cache(vaddr, spa, VM_PROT_READ | VM_PROT_WRITE,
pmap_kenter_cache(vaddr, spa, PROT_READ | PROT_WRITE,
(flags & BUS_SPACE_MAP_CACHEABLE) ?
PMAP_CACHE_WT : PMAP_CACHE_CI);
spa += PAGE_SIZE;
@ -632,7 +632,7 @@ mapiodev(paddr_t pa, psize_t len)
for (vaddr = va; size > 0; size -= PAGE_SIZE) {
pmap_kenter_cache(vaddr, spa,
VM_PROT_READ | VM_PROT_WRITE, PMAP_CACHE_DEFAULT);
PROT_READ | PROT_WRITE, PMAP_CACHE_DEFAULT);
spa += PAGE_SIZE;
vaddr += PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.43 2014/09/20 09:28:24 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.44 2014/11/16 12:30:58 deraadt Exp $ */
/* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */
/*
@ -130,7 +130,8 @@ cpu_startup()
/*
* fix message buffer mapping
*/
pmap_map(MSGBUF_VA, MSGBUF_PA, MSGBUF_PA + MSGBUFSIZE, UVM_PROT_RW);
pmap_map(MSGBUF_VA, MSGBUF_PA, MSGBUF_PA + MSGBUFSIZE,
PROT_READ | PROT_WRITE);
initmsgbuf((caddr_t)(MSGBUF_VA + (CPU_ISSUN4 ? 4096 : 0)), MSGBUFSIZE);
proc0.p_addr = proc0paddr;
@ -629,7 +630,8 @@ mapdev(phys, virt, offset, size)
pmtype = PMAP_IOENC(phys->rr_iospace);
do {
pmap_kenter_pa(va, pa | pmtype | PMAP_NC, UVM_PROT_RW);
pmap_kenter_pa(va, pa | pmtype | PMAP_NC,
PROT_READ | PROT_WRITE);
va += PAGE_SIZE;
pa += PAGE_SIZE;
} while ((size -= PAGE_SIZE) > 0);
@ -732,7 +734,7 @@ kap_maskcheck()
void (*test)(void);
pmap_enter(pmap_kernel(), TMPMAP_VA,
trunc_page((vaddr_t)masktest) | PMAP_BWS, UVM_PROT_READ, 0);
trunc_page((vaddr_t)masktest) | PMAP_BWS, PROT_READ, 0);
test = (void (*)(void))(TMPMAP_VA + ((vaddr_t)masktest & PAGE_MASK));
cpcb->pcb_onfault = (caddr_t)kap_maskfault;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mem.c,v 1.2 2007/09/22 16:21:32 krw Exp $ */
/* $OpenBSD: mem.c,v 1.3 2014/11/16 12:30:58 deraadt Exp $ */
/* OpenBSD: mem.c,v 1.21 2003/06/02 23:27:55 millert Exp */
/*
@ -140,7 +140,7 @@ mmrw(dev, uio, flags)
}
pmap_enter(pmap_kernel(), mem_page,
trunc_page(pa), uio->uio_rw == UIO_READ ?
VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED);
PROT_READ : PROT_WRITE, PMAP_WIRED);
pmap_update(pmap_kernel());
o = uio->uio_offset & PGOFSET;
c = min(uio->uio_resid, (int)(NBPG - o));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.6 2014/01/24 05:33:32 jsg Exp $ */
/* $OpenBSD: pmap.c,v 1.7 2014/11/16 12:30:58 deraadt Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
*
@ -789,7 +789,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
struct pvlist *pvl;
int s;
if ((prot & VM_PROT_READ) == VM_PROT_NONE) { /* remove all */
if ((prot & PROT_READ) == PROT_NONE) { /* remove all */
s = splvm();
pvl = pg_to_pvl(pg);
@ -802,7 +802,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
}
splx(s);
} else if ((prot & VM_PROT_WRITE) == VM_PROT_NONE) {
} else if ((prot & PROT_WRITE) == PROT_NONE) {
s = splvm();
pvl = pg_to_pvl(pg);
@ -838,7 +838,7 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t e, vm_prot_t prot)
DPRINTF(PDB_PROTECT,
("pmap_protect(%p,%08x,%08x,%x)\n", pmap, sva, e, prot));
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
if ((prot & PROT_READ) == PROT_NONE) {
pmap_remove(pmap, sva, e);
splx(s);
return;
@ -863,7 +863,7 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t e, vm_prot_t prot)
continue;
npte = (opte & ~PG_RO) |
(prot & VM_PROT_WRITE) ? PG_RW : PG_RO;
(prot & PROT_WRITE) ? PG_RW : PG_RO;
if (opte != npte) {
*pte = npte;
tlb_flush(va);
@ -944,7 +944,7 @@ pmap_enter(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
}
pa = trunc_page(pa);
npte |= pa | PG_V | (prot & VM_PROT_WRITE ? PG_RW : PG_RO);
npte |= pa | PG_V | (prot & PROT_WRITE ? PG_RW : PG_RO);
pg = PHYS_TO_VM_PAGE(pa);
if (pg != NULL) {
@ -1064,7 +1064,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
}
pa = trunc_page(pa);
npte |= pa | PG_V | PG_W | (prot & VM_PROT_WRITE ? PG_RW : PG_RO);
npte |= pa | PG_V | PG_W | (prot & PROT_WRITE ? PG_RW : PG_RO);
if ((opte & PG_W) == 0)
pmap_kernel()->pm_stats.wired_count++;
@ -1476,7 +1476,7 @@ pmap_changeprot(struct pmap *pmap, vaddr_t va, vm_prot_t prot, int wired)
s = splvm();
npte = PG_S | (prot & VM_PROT_WRITE ? PG_RW : PG_RO);
npte = PG_S | (prot & PROT_WRITE ? PG_RW : PG_RO);
pte = pmap_pte(pmap, va);
if ((*pte & PG_PROT) != npte) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.21 2014/05/11 00:12:44 guenther Exp $ */
/* $OpenBSD: trap.c,v 1.22 2014/11/16 12:30:58 deraadt Exp $ */
/* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */
/*
@ -651,7 +651,7 @@ mem_access_fault(type, ser, v, pc, psr, tf)
*/
if (type == T_TEXTFAULT)
v = pc;
ftype = ser & FCR_RO ? VM_PROT_WRITE : VM_PROT_READ;
ftype = ser & FCR_RO ? PROT_WRITE : PROT_READ;
va = trunc_page(v);
if (psr & PSR_PS) {
if (type == T_TEXTFAULT) {
@ -724,8 +724,8 @@ kfault:
}
sv.sival_int = v;
trapsignal(p, SIGSEGV, (ser & FCR_RO) ? VM_PROT_WRITE :
VM_PROT_READ, SEGV_MAPERR, sv);
trapsignal(p, SIGSEGV, (ser & FCR_RO) ? PROT_WRITE :
PROT_READ, SEGV_MAPERR, sv);
}
out:
if ((psr & PSR_PS) == 0) {

Some files were not shown because too many files have changed in this diff Show More