diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-03-12 23:03:26 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-03-12 23:03:26 +0000 |
commit | 64f997dbc300d1a05ec0874b8d9eaf435d516369 (patch) | |
tree | 6ea4db1a154cfec4cde335260846f6a63ba3c4b9 /sys/arch/mvme88k | |
parent | 756387b20009fe5d64a6b969926a658587d88b2b (diff) |
Simplify vmapbuf by moving the vm_map_pmap computation off loop (inspired
by similar code in the sparc port).
Compile the diagnostic code in vmapbuf and vunmapbuf only if DIAGNOSTIC
is defined.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/mvme88k/vm_machdep.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 09258c5e544..8761f80cee1 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.19 2001/03/09 05:44:43 smurph Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.20 2001/03/12 23:03:25 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -237,19 +237,23 @@ extern vm_map_t phys_map; * be reflected in the higher-level VM structures to avoid problems. */ void -vmapbuf(struct buf *bp, vm_size_t len) +vmapbuf(bp, len) + struct buf *bp; + vm_size_t len; { register caddr_t addr; register vm_offset_t pa, kva, off; - struct proc *p; + struct pmap *pmap; +#ifdef DIAGNOSTIC if ((bp->b_flags & B_PHYS) == 0) panic("vmapbuf"); +#endif addr = (caddr_t)trunc_page(bp->b_saveaddr = bp->b_data); off = (vm_offset_t)bp->b_saveaddr & PGOFSET; len = round_page(off + len); - p = bp->b_proc; + pmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map); /* * You may ask: Why phys_map? kernel_map should be OK - after all, @@ -274,8 +278,7 @@ vmapbuf(struct buf *bp, vm_size_t len) bp->b_data = (caddr_t)(kva + off); while (len > 0) { - pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), - (vm_offset_t)addr); + pa = pmap_extract(pmap, (vm_offset_t)addr); if (pa == 0) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), kva, pa, @@ -291,12 +294,16 @@ vmapbuf(struct buf *bp, vm_size_t len) * We also restore the original b_addr. */ void -vunmapbuf(struct buf *bp, vm_size_t len) +vunmapbuf(bp, len) + struct buf *bp; + vm_size_t len; { register vm_offset_t addr, off; +#ifdef DIAGNOSTIC if ((bp->b_flags & B_PHYS) == 0) panic("vunmapbuf"); +#endif addr = trunc_page(bp->b_data); off = (vm_offset_t)bp->b_data & PGOFSET; |