Subject: Re: pmap_enter(9) flags in vmapbuf()
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Jason Thorpe <thorpej@shagadelic.org>
List: port-mips
Date: 03/27/2005 00:09:15
On Mar 26, 2005, at 2:39 AM, Izumi Tsutsui wrote:
> Precisely, is it worth to pass VM_PROT_READ (and VM_PROT_WRITE on
> B_READ)
> to pmap_enter(9) flags in vmapbuf() on mips?
The pmap_enter() flags argument must always have at least the
permissions that are in the prot argument if flags also has PMAP_WIRED.
> And should we pass VM_PROT_WRITE in pmap_enter() prot arg only
> on B_READ too?
> ---
> Izumi Tsutsui
>
>
> Index: mips/vm_machdep.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/mips/mips/vm_machdep.c,v
> retrieving revision 1.105
> diff -u -r1.105 vm_machdep.c
> --- mips/vm_machdep.c 1 Jan 2005 03:25:46 -0000 1.105
> +++ mips/vm_machdep.c 26 Mar 2005 02:40:27 -0000
> @@ -318,6 +306,7 @@
> vaddr_t kva; /* Kernel VA (new to) */
> paddr_t pa; /* physical address */
> vsize_t off;
> + int prot;
>
> if ((bp->b_flags & B_PHYS) == 0)
> panic("vmapbuf");
> @@ -329,11 +318,12 @@
> bp->b_data = (caddr_t)(kva + off);
>
> upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
> + prot = VM_PROT_READ | ((bp->b_flags & B_READ) ?
> VM_PROT_WRITE : 0);
> do {
> if (pmap_extract(upmap, uva, &pa) == FALSE)
> panic("vmapbuf: null page frame");
> pmap_enter(vm_map_pmap(phys_map), kva, pa,
> - VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
> + prot, prot | PMAP_WIRED);
> uva += PAGE_SIZE;
> kva += PAGE_SIZE;
> len -= PAGE_SIZE;
>
-- thorpej