diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-02-25 19:08:51 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-02-25 19:08:51 +0000 |
commit | a977d6c75f14582e9a1e812c1c70846411179311 (patch) | |
tree | f37c7eb4eb516e603263874fd853266f79c2e021 | |
parent | 166beffa35e4d1ccf60564afb26f691678a33abc (diff) |
vmapbuf/vunmapbuf
-rw-r--r-- | sys/arch/hppa/hppa/vm_machdep.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index 31a3b72fd8b..f88c8178770 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.2 1999/01/10 13:34:18 niklas Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.3 1999/02/25 19:08:50 mickey Exp $ */ #include <sys/param.h> #include <sys/systm.h> @@ -8,6 +8,7 @@ #include <sys/vnode.h> #include <sys/user.h> +#include <vm/vm_kern.h> #include <machine/pmap.h> #include <vm/vm.h> @@ -68,13 +69,21 @@ void cpu_fork(p1, p2) struct proc *p1, *p2; { + p2->p_md.md_flags = p1->p_md.md_flags; + + p2->p_addr->u_pcb = p1->p_addr->u_pcb; + + /* TODO: create the child's kernel stack */ } void cpu_exit(p) struct proc *p; { + /* TODO: anything to be done about FPU */ + vmspace_free(p->p_vmspace); + /* to the switch */ } @@ -94,18 +103,54 @@ cpu_set_kpc(p, pc, arg) } +/* + * Map an IO request into kernel virtual address space. + */ void vmapbuf(bp, len) struct buf *bp; vm_size_t len; { + vm_offset_t faddr, taddr, off, pa; + struct proc *p; + if ((bp->b_flags & B_PHYS) == 0) + panic("vmapbuf"); + p = bp->b_proc; + faddr = trunc_page(bp->b_saveaddr = bp->b_data); + off = (vm_offset_t)bp->b_data - faddr; + len = round_page(off + len); + taddr = kmem_alloc_wait(phys_map, len); + bp->b_data = (caddr_t)(taddr + off); + len = atop(len); + while (len--) { + pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr); + if (pa == 0) + panic("vmapbuf: null page frame"); + pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa), + VM_PROT_READ|VM_PROT_WRITE, TRUE); + faddr += PAGE_SIZE; + taddr += PAGE_SIZE; + } } +/* + * Unmap IO request from the kernel virtual address space. + */ void vunmapbuf(bp, len) struct buf *bp; vm_size_t len; { + vm_offset_t addr, off; + + if ((bp->b_flags & B_PHYS) == 0) + panic("vunmapbuf"); + addr = trunc_page(bp->b_data); + off = (vm_offset_t)bp->b_data - addr; + len = round_page(off + len); + kmem_free_wakeup(phys_map, addr, len); + bp->b_data = bp->b_saveaddr; + bp->b_saveaddr = NULL; } |