Source-Changes-HG archive

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

[src/trunk]: src/sys Merge parts of chs-ubc2 into the trunk:



details:   https://anonhg.NetBSD.org/src/rev/8562bdd1fb52
branches:  trunk
changeset: 484143:8562bdd1fb52
user:      kleink <kleink%NetBSD.org@localhost>
date:      Sun Mar 26 20:54:45 2000 +0000

description:
Merge parts of chs-ubc2 into the trunk:
Add a new type voff_t (defined as a synonym for off_t) to describe offsets
into uvm objects, and update the appropriate interfaces to use it, the
most visible effect being the ability to mmap() file offsets beyond
the range of a vaddr_t.

Originally by Chuck Silvers; blame me for problems caused by merging this
into non-UBC.

diffstat:

 sys/sys/vnode.h      |   3 +-
 sys/uvm/uvm_aobj.c   |  28 ++++++++---------
 sys/uvm/uvm_device.c |  21 +++++++------
 sys/uvm/uvm_extern.h |  14 ++++----
 sys/uvm/uvm_glue.c   |  22 +++++++-------
 sys/uvm/uvm_map.c    |  10 +++---
 sys/uvm/uvm_map.h    |  33 +++++++-------------
 sys/uvm/uvm_mmap.c   |  21 +++----------
 sys/uvm/uvm_page.c   |   6 +-
 sys/uvm/uvm_page.h   |   5 +-
 sys/uvm/uvm_page_i.h |   4 +-
 sys/uvm/uvm_pager.c  |  10 +++---
 sys/uvm/uvm_pager.h  |  21 ++++++-------
 sys/uvm/uvm_unix.c   |   4 +-
 sys/uvm/uvm_vnode.c  |  80 +++++++++++++++++++++------------------------------
 sys/uvm/uvm_vnode.h  |   4 +-
 sys/vm/vm.h          |   5 +-
 sys/vm/vm_map.h      |   4 +-
 sys/vm/vm_page.h     |   8 ++--
 19 files changed, 134 insertions(+), 169 deletions(-)

diffs (truncated from 905 to 300 lines):

diff -r f5ded9910448 -r 8562bdd1fb52 sys/sys/vnode.h
--- a/sys/sys/vnode.h   Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/sys/vnode.h   Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnode.h,v 1.69 2000/02/14 22:00:22 fvdl Exp $  */
+/*     $NetBSD: vnode.h,v 1.70 2000/03/26 20:54:45 kleink Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -46,6 +46,7 @@
 #include <vm/vm_param.h>       /* XXX */
 #include <sys/lock.h>          /* XXX */
 #include <uvm/uvm_object.h>    /* XXX */
+#include <vm/vm.h>             /* XXX */
 #include <uvm/uvm_vnode.h>     /* XXX */
 
 /*
diff -r f5ded9910448 -r 8562bdd1fb52 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/uvm/uvm_aobj.c        Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.27 2000/01/11 06:57:49 chs Exp $        */
+/*     $NetBSD: uvm_aobj.c,v 1.28 2000/03/26 20:54:46 kleink Exp $     */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -124,7 +124,7 @@
 
 struct uao_swhash_elt {
        LIST_ENTRY(uao_swhash_elt) list;        /* the hash list */
-       vaddr_t tag;                            /* our 'tag' */
+       voff_t tag;                             /* our 'tag' */
        int count;                              /* our number of active slots */
        int slots[UAO_SWHASH_CLUSTER_SIZE];     /* the slots */
 };
@@ -175,16 +175,14 @@
 
 static struct uao_swhash_elt   *uao_find_swhash_elt __P((struct uvm_aobj *,
                                                          int, boolean_t));
-static int                      uao_find_swslot __P((struct uvm_aobj *, 
-                                                     int));
-static boolean_t                uao_flush __P((struct uvm_object *, 
-                                               vaddr_t, vaddr_t, 
-                                               int));
+static int                      uao_find_swslot __P((struct uvm_aobj *, int));
+static boolean_t                uao_flush __P((struct uvm_object *,
+                                               voff_t, voff_t, int));
 static void                     uao_free __P((struct uvm_aobj *));
-static int                      uao_get __P((struct uvm_object *, vaddr_t,
-                                             vm_page_t *, int *, int, 
+static int                      uao_get __P((struct uvm_object *, voff_t,
+                                             vm_page_t *, int *, int,
                                              vm_prot_t, int, int));
-static boolean_t                uao_releasepg __P((struct vm_page *, 
+static boolean_t                uao_releasepg __P((struct vm_page *,
                                                    struct vm_page **));
 static boolean_t                uao_pagein __P((struct uvm_aobj *, int, int));
 static boolean_t                uao_pagein_page __P((struct uvm_aobj *, int));
@@ -244,7 +242,7 @@
 {
        struct uao_swhash *swhash;
        struct uao_swhash_elt *elt;
-       int page_tag;
+       voff_t page_tag;
 
        swhash = UAO_SWHASH_HASH(aobj, pageidx); /* first hash to get bucket */
        page_tag = UAO_SWHASH_ELT_TAG(pageidx); /* tag to search for */
@@ -798,13 +796,13 @@
 boolean_t
 uao_flush(uobj, start, stop, flags)
        struct uvm_object *uobj;
-       vaddr_t start, stop;
+       voff_t start, stop;
        int flags;
 {
        struct uvm_aobj *aobj = (struct uvm_aobj *) uobj;
        struct vm_page *pp, *ppnext;
        boolean_t retval, by_list;
-       vaddr_t curoff;
+       voff_t curoff;
        UVMHIST_FUNC("uao_flush"); UVMHIST_CALLED(maphist);
 
        curoff = 0;     /* XXX: shut up gcc */
@@ -966,14 +964,14 @@
 static int
 uao_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags)
        struct uvm_object *uobj;
-       vaddr_t offset;
+       voff_t offset;
        struct vm_page **pps;
        int *npagesp;
        int centeridx, advice, flags;
        vm_prot_t access_type;
 {
        struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
-       vaddr_t current_offset;
+       voff_t current_offset;
        vm_page_t ptmp;
        int lcv, gotpages, maxpages, swslot, rv, pageidx;
        boolean_t done;
diff -r f5ded9910448 -r 8562bdd1fb52 sys/uvm/uvm_device.c
--- a/sys/uvm/uvm_device.c      Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/uvm/uvm_device.c      Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_device.c,v 1.19 2000/03/26 20:46:59 kleink Exp $   */
+/*     $NetBSD: uvm_device.c,v 1.20 2000/03/26 20:54:46 kleink Exp $   */
 
 /*
  *
@@ -74,10 +74,10 @@
 static int             udv_fault __P((struct uvm_faultinfo *, vaddr_t,
                                       vm_page_t *, int, int, vm_fault_t,
                                       vm_prot_t, int));
-static boolean_t        udv_flush __P((struct uvm_object *, vaddr_t, 
-                                        vaddr_t, int));
-static int             udv_asyncget __P((struct uvm_object *, vaddr_t,
-                                           int));
+static int             udv_asyncget __P((struct uvm_object *, voff_t,
+                                      int));
+static boolean_t        udv_flush __P((struct uvm_object *, voff_t, voff_t,
+                                      int));
 static int             udv_put __P((struct uvm_object *, vm_page_t *,
                                        int, boolean_t));
 
@@ -374,7 +374,7 @@
 
 static boolean_t udv_flush(uobj, start, stop, flags)
        struct uvm_object *uobj;
-       vaddr_t start, stop;
+       voff_t start, stop;
        int flags;
 {
 
@@ -409,7 +409,8 @@
        struct vm_map_entry *entry = ufi->entry;
        struct uvm_object *uobj = entry->object.uvm_obj;
        struct uvm_device *udv = (struct uvm_device *)uobj;
-       vaddr_t curr_offset, curr_va;
+       vaddr_t curr_va;
+       int curr_offset;
        paddr_t paddr;
        int lcv, retval, mdpgno;
        dev_t device;
@@ -450,7 +451,7 @@
         * addresses in a submap must match the main map, this is ok.
         */
        /* udv offset = (offset from start of entry) + entry's offset */
-       curr_offset = (vaddr - entry->start) + entry->offset;   
+       curr_offset = (int)((vaddr - entry->start) + entry->offset);
        /* pmap va = vaddr (virtual address of pps[0]) */
        curr_va = vaddr;
        
@@ -467,7 +468,7 @@
                if (pps[lcv] == PGO_DONTCARE)
                        continue;
 
-               mdpgno = (*mapfn)(device, (int)curr_offset, access_type);
+               mdpgno = (*mapfn)(device, curr_offset, access_type);
                if (mdpgno == -1) {
                        retval = VM_PAGER_ERROR;
                        break;
@@ -510,7 +511,7 @@
 static int
 udv_asyncget(uobj, offset, npages)
        struct uvm_object *uobj;
-       vaddr_t offset;
+       voff_t offset;
        int npages;
 {
 
diff -r f5ded9910448 -r 8562bdd1fb52 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/uvm/uvm_extern.h      Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.37 2000/02/11 19:22:54 thorpej Exp $  */
+/*     $NetBSD: uvm_extern.h,v 1.38 2000/03/26 20:54:46 kleink Exp $   */
 
 /*
  *
@@ -112,7 +112,7 @@
        ((MAXPROT << 8)|(PROT)|(INH)|((ADVICE) << 12)|(FLAGS))
 
 /* magic offset value */
-#define UVM_UNKNOWN_OFFSET ((vaddr_t) -1)
+#define UVM_UNKNOWN_OFFSET ((voff_t) -1)
                                /* offset not known(obj) or don't care(!obj) */
 
 /*
@@ -334,7 +334,7 @@
 
 /* uvm_map.c */
 int                    uvm_map __P((vm_map_t, vaddr_t *, vsize_t,
-                               struct uvm_object *, vaddr_t, uvm_flag_t));
+                               struct uvm_object *, voff_t, uvm_flag_t));
 int                    uvm_map_pageable __P((vm_map_t, vaddr_t, 
                                vaddr_t, boolean_t, int));
 int                    uvm_map_pageable_all __P((vm_map_t, int, vsize_t));
@@ -361,16 +361,16 @@
 /* uvm_mmap.c */
 int                    uvm_mmap __P((vm_map_t, vaddr_t *, vsize_t,
                                vm_prot_t, vm_prot_t, int, 
-                               caddr_t, vaddr_t, vsize_t));
+                               caddr_t, voff_t, vsize_t));
 
 /* uvm_page.c */
 struct vm_page         *uvm_pagealloc_strat __P((struct uvm_object *,
-                               vaddr_t, struct vm_anon *, int, int, int));
+                               voff_t, struct vm_anon *, int, int, int));
 #define        uvm_pagealloc(obj, off, anon, flags) \
            uvm_pagealloc_strat((obj), (off), (anon), (flags), \
                                UVM_PGA_STRAT_NORMAL, 0)
 void                   uvm_pagerealloc __P((struct vm_page *, 
-                                            struct uvm_object *, vaddr_t));
+                                            struct uvm_object *, voff_t));
 /* Actually, uvm_page_physload takes PF#s which need their own type */
 void                   uvm_page_physload __P((paddr_t, paddr_t,
                                               paddr_t, paddr_t, int));
@@ -401,7 +401,7 @@
 int                    uvm_deallocate __P((vm_map_t, vaddr_t, vsize_t));
 
 /* uvm_vnode.c */
-void                   uvm_vnp_setsize __P((struct vnode *, u_quad_t));
+void                   uvm_vnp_setsize __P((struct vnode *, voff_t));
 void                   uvm_vnp_sync __P((struct mount *));
 void                   uvm_vnp_terminate __P((struct vnode *));
                                /* terminate a uvm/uvn object */
diff -r f5ded9910448 -r 8562bdd1fb52 sys/uvm/uvm_glue.c
--- a/sys/uvm/uvm_glue.c        Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/uvm/uvm_glue.c        Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_glue.c,v 1.30 1999/11/13 00:24:38 thorpej Exp $    */
+/*     $NetBSD: uvm_glue.c,v 1.31 2000/03/26 20:54:47 kleink Exp $     */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -149,8 +149,8 @@
        vaddr_t saddr, eaddr;
        vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE;
 
-       saddr = trunc_page(addr);
-       eaddr = round_page(addr+len);
+       saddr = trunc_page((vaddr_t)addr);
+       eaddr = round_page((vaddr_t)addr+len);
        vm_map_lock_read(kernel_map);
        rv = uvm_map_checkprot(kernel_map, saddr, eaddr, prot);
        vm_map_unlock_read(kernel_map);
@@ -190,8 +190,8 @@
        map = &curproc->p_vmspace->vm_map;
 
        vm_map_lock_read(map);
-       rv = uvm_map_checkprot(map, trunc_page(addr), round_page(addr+len),
-           prot);
+       rv = uvm_map_checkprot(map, trunc_page((vaddr_t)addr),
+           round_page((vaddr_t)addr+len), prot);
        vm_map_unlock_read(map);
 
        return(rv);
@@ -221,8 +221,8 @@
        vaddr_t sva, eva;
 
        prot = rw == B_READ ? VM_PROT_READ : VM_PROT_READ|VM_PROT_WRITE;
-       eva = round_page(addr + len);
-       for (sva = trunc_page(addr); sva < eva; sva += PAGE_SIZE) {
+       eva = round_page((vaddr_t)addr + len);
+       for (sva = trunc_page((vaddr_t)addr); sva < eva; sva += PAGE_SIZE) {
                /*
                 * Extract physical address for the page.
                 * We use a cheezy hack to differentiate physical
@@ -255,8 +255,8 @@
        int rv;
 
        map = &p->p_vmspace->vm_map;
-       start = trunc_page(addr);
-       end = round_page(addr + len);
+       start = trunc_page((vaddr_t)addr);
+       end = round_page((vaddr_t)addr + len);
 
        rv = uvm_fault_wire(map, start, end, access_type);
 
@@ -276,8 +276,8 @@
        caddr_t addr;
        size_t  len;
 {
-       uvm_fault_unwire(&p->p_vmspace->vm_map, trunc_page(addr), 
-               round_page(addr+len));
+       uvm_fault_unwire(&p->p_vmspace->vm_map, trunc_page((vaddr_t)addr), 
+               round_page((vaddr_t)addr+len));
 }
 
 /*
diff -r f5ded9910448 -r 8562bdd1fb52 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Sun Mar 26 20:46:59 2000 +0000
+++ b/sys/uvm/uvm_map.c Sun Mar 26 20:54:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.69 1999/09/12 01:17:37 chs Exp $ */
+/*     $NetBSD: uvm_map.c,v 1.70 2000/03/26 20:54:47 kleink Exp $      */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -472,7 +472,7 @@



Home | Main Index | Thread Index | Old Index