Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys add prot parameter for uvm_emap_enter(), so...



details:   https://anonhg.NetBSD.org/src/rev/ad3956990452
branches:  trunk
changeset: 318400:ad3956990452
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Apr 20 19:02:18 2018 +0000
description:
add prot parameter for uvm_emap_enter(), so that it's possible to
enter also read/write mappings

diffstat:

 sys/kern/sys_pipe.c  |   7 ++++---
 sys/uvm/uvm_emap.c   |  14 +++++++-------
 sys/uvm/uvm_extern.h |   5 +++--
 3 files changed, 14 insertions(+), 12 deletions(-)

diffs (108 lines):

diff -r 329b9b89b1a8 -r ad3956990452 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Fri Apr 20 18:58:10 2018 +0000
+++ b/sys/kern/sys_pipe.c       Fri Apr 20 19:02:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_pipe.c,v 1.143 2017/12/26 08:30:58 kamil Exp $     */
+/*     $NetBSD: sys_pipe.c,v 1.144 2018/04/20 19:02:18 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.143 2017/12/26 08:30:58 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.144 2018/04/20 19:02:18 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -747,7 +747,8 @@
        }
 
        /* Enter the loaned pages to KVA, produce new emap generation number. */
-       uvm_emap_enter(wmap->kva + ptoa(starting_color), pgs, npages);
+       uvm_emap_enter(wmap->kva + ptoa(starting_color), pgs, npages,
+           VM_PROT_READ);
        wmap->egen = uvm_emap_produce();
 
        /* Now we can put the pipe in direct write mode */
diff -r 329b9b89b1a8 -r ad3956990452 sys/uvm/uvm_emap.c
--- a/sys/uvm/uvm_emap.c        Fri Apr 20 18:58:10 2018 +0000
+++ b/sys/uvm/uvm_emap.c        Fri Apr 20 19:02:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_emap.c,v 1.12 2018/04/02 18:25:41 jdolecek Exp $   */
+/*     $NetBSD: uvm_emap.c,v 1.13 2018/04/20 19:02:18 jdolecek Exp $   */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  *
  * Map pages at the address:
  *
- *     uvm_emap_enter(va, pgs, npages);
+ *     uvm_emap_enter(va, pgs, npages, VM_PROT_READ);
  *     gen = uvm_emap_produce();
  *
  * Read pages via the mapping:
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.12 2018/04/02 18:25:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.13 2018/04/20 19:02:18 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -185,14 +185,14 @@
  * uvm_emap_enter: enter a new mapping, without TLB flush.
  */
 void
-uvm_emap_enter(vaddr_t va, struct vm_page **pgs, u_int npages)
+uvm_emap_enter(vaddr_t va, struct vm_page **pgs, u_int npages, vm_prot_t prot)
 {
        paddr_t pa;
        u_int n;
 
        for (n = 0; n < npages; n++, va += PAGE_SIZE) {
                pa = VM_PAGE_TO_PHYS(pgs[n]);
-               pmap_emap_enter(va, pa, VM_PROT_READ);
+               pmap_emap_enter(va, pa, prot);
        }
 }
 
@@ -387,14 +387,14 @@
  */
 
 void
-uvm_emap_enter(vaddr_t va, struct vm_page **pgs, u_int npages)
+uvm_emap_enter(vaddr_t va, struct vm_page **pgs, u_int npages, vm_prot_t prot)
 {
        paddr_t pa;
        u_int n;
 
        for (n = 0; n < npages; n++, va += PAGE_SIZE) {
                pa = VM_PAGE_TO_PHYS(pgs[n]);
-               pmap_kenter_pa(va, pa, VM_PROT_READ, 0);
+               pmap_kenter_pa(va, pa, prot, 0);
        }
        pmap_update(pmap_kernel());
 }
diff -r 329b9b89b1a8 -r ad3956990452 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Fri Apr 20 18:58:10 2018 +0000
+++ b/sys/uvm/uvm_extern.h      Fri Apr 20 19:02:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.209 2018/04/20 18:58:10 jdolecek Exp $        */
+/*     $NetBSD: uvm_extern.h,v 1.210 2018/04/20 19:02:18 jdolecek Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -632,7 +632,8 @@
 vaddr_t                        uvm_emap_alloc(vsize_t, bool);
 void                   uvm_emap_free(vaddr_t, size_t);
 
-void                   uvm_emap_enter(vaddr_t, struct vm_page **, u_int);
+void                   uvm_emap_enter(vaddr_t, struct vm_page **, u_int,
+                           vm_prot_t);
 void                   uvm_emap_remove(vaddr_t, vsize_t);
 
 #ifdef __HAVE_PMAP_EMAP



Home | Main Index | Thread Index | Old Index