From 2a4977388d8ca2cef9e73cd2e0bbdaef83b4a180 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Fri, 3 Sep 1999 18:02:30 +0000 Subject: Change the pmap_enter api to pass down an argument that indicates the access type that caused this mapping. This is to simplify pmaps with mod/ref emulation (none for the moment) and in some cases speed up pmap_is_{referenced,modified}. At the same time, clean up some mappings that had too high protection. XXX - the access type is incorrect in old vm, it's only used by uvm and MD code. The actual use of this in pmap_enter implementations is not in this commit. --- sys/arch/i386/i386/machdep.c | 22 ++++++++++++++-------- sys/arch/i386/i386/mem.c | 4 ++-- sys/arch/i386/i386/pmap.c | 7 ++++--- sys/arch/i386/i386/pmap.old.c | 7 ++++--- 4 files changed, 24 insertions(+), 16 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 825574d7c39..d77c4a24295 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.112 1999/08/20 10:33:34 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.113 1999/09/03 18:00:50 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -291,8 +291,10 @@ cpu_startup() /* avail_end was pre-decremented in pmap_bootstrap to compensate */ for (i = 0; i < btoc(sizeof(struct msgbuf)); i++, pa += NBPG) pmap_enter(pmap_kernel(), - (vm_offset_t)((caddr_t)msgbufp + i * NBPG), - pa, VM_PROT_ALL, TRUE); + (vm_offset_t)((caddr_t)msgbufp + i * NBPG), pa, + VM_PROT_READ|VM_PROT_WRITE, TRUE, + VM_PROT_READ|VM_PROT_WRITE); + msgbufmapped = 1; /* Boot arguments are in page 1 */ @@ -300,8 +302,9 @@ cpu_startup() pa = (vm_offset_t)bootargv; for (i = 0; i < btoc(bootargc); i++, pa += NBPG) pmap_enter(pmap_kernel(), - (vm_offset_t)((caddr_t)bootargp + i * NBPG), - pa, VM_PROT_READ|VM_PROT_WRITE, TRUE); + (vm_offset_t)((caddr_t)bootargp + i * NBPG), pa, + VM_PROT_READ|VM_PROT_WRITE, TRUE, + VM_PROT_READ|VM_PROT_WRITE); } else bootargp = NULL; @@ -609,7 +612,8 @@ setup_buffers(maxaddr) for (size = CLBYTES * (i < residual ? base + 1 : base); size > 0; size -= NBPG, addr += NBPG) { pmap_enter(pmap_kernel(), addr, pg->phys_addr, - VM_PROT_READ|VM_PROT_WRITE, TRUE); + VM_PROT_READ|VM_PROT_WRITE, TRUE, + VM_PROT_READ|VM_PROT_WRITE); pg = pg->pageq.tqe_next; } } @@ -2368,7 +2372,8 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) for (; pa < endpa; pa += NBPG, va += NBPG) { pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, TRUE); + VM_PROT_READ | VM_PROT_WRITE, TRUE, + VM_PROT_READ | VM_PROT_WRITE); if (!cacheable) pmap_changebit(pa, PG_N, ~0); else @@ -2775,7 +2780,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (size == 0) panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, TRUE); + VM_PROT_READ | VM_PROT_WRITE, TRUE, + VM_PROT_READ | VM_PROT_WRITE); } } diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index c98ddeeb517..0beaea86984 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.11 1999/02/26 04:41:13 art Exp $ */ +/* $OpenBSD: mem.c,v 1.12 1999/09/03 18:00:51 art Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -168,7 +168,7 @@ mmrw(dev, uio, flags) v = uio->uio_offset; pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE); + VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index ffe15058102..41edc83c84e 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.31 1999/08/25 09:13:53 ho Exp $ */ +/* $OpenBSD: pmap.c,v 1.32 1999/09/03 18:00:51 art Exp $ */ /* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */ /* @@ -658,7 +658,7 @@ pmap_map(va, spa, epa, prot) #endif while (spa < epa) { - pmap_enter(pmap_kernel(), va, spa, prot, FALSE); + pmap_enter(pmap_kernel(), va, spa, prot, FALSE, 0); va += NBPG; spa += NBPG; } @@ -1149,12 +1149,13 @@ pmap_protect(pmap, sva, eva, prot) * insert this page into the given map NOW. */ void -pmap_enter(pmap, va, pa, prot, wired) +pmap_enter(pmap, va, pa, prot, wired, access_type) register pmap_t pmap; vm_offset_t va; register vm_offset_t pa; vm_prot_t prot; boolean_t wired; + vm_prot_t access_type; { register pt_entry_t *pte; register pt_entry_t npte; diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c index 50fb4a90c3e..d23afcc7bde 100644 --- a/sys/arch/i386/i386/pmap.old.c +++ b/sys/arch/i386/i386/pmap.old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.old.c,v 1.31 1999/08/25 09:13:53 ho Exp $ */ +/* $OpenBSD: pmap.old.c,v 1.32 1999/09/03 18:00:51 art Exp $ */ /* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */ /* @@ -658,7 +658,7 @@ pmap_map(va, spa, epa, prot) #endif while (spa < epa) { - pmap_enter(pmap_kernel(), va, spa, prot, FALSE); + pmap_enter(pmap_kernel(), va, spa, prot, FALSE, 0); va += NBPG; spa += NBPG; } @@ -1149,12 +1149,13 @@ pmap_protect(pmap, sva, eva, prot) * insert this page into the given map NOW. */ void -pmap_enter(pmap, va, pa, prot, wired) +pmap_enter(pmap, va, pa, prot, wired, access_type) register pmap_t pmap; vm_offset_t va; register vm_offset_t pa; vm_prot_t prot; boolean_t wired; + vm_prot_t access_type; { register pt_entry_t *pte; register pt_entry_t npte; -- cgit v1.2.3