summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/uvm/uvm_extern.h5
-rw-r--r--sys/uvm/uvm_km.c15
-rw-r--r--sys/uvm/uvm_map.c20
-rw-r--r--sys/uvm/uvm_map_i.h26
-rw-r--r--sys/uvm/uvm_mmap.c26
-rw-r--r--sys/uvm/uvm_page_i.h27
6 files changed, 39 insertions, 80 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 3ea0d031190..24102f0437c 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_extern.h,v 1.30 2001/11/07 02:55:50 art Exp $ */
-/* $NetBSD: uvm_extern.h,v 1.51 2000/09/28 19:05:06 eeh Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.31 2001/11/09 03:32:23 art Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.52 2000/11/27 04:36:40 nisimura Exp $ */
/*
*
@@ -489,6 +489,7 @@ struct vm_map *uvm_km_suballoc __P((vm_map_t, vaddr_t *,
vaddr_t *, vsize_t, int,
boolean_t, vm_map_t));
vaddr_t uvm_km_valloc __P((vm_map_t, vsize_t));
+vaddr_t uvm_km_valloc_align __P((vm_map_t, vsize_t, vsize_t));
vaddr_t uvm_km_valloc_wait __P((vm_map_t, vsize_t));
vaddr_t uvm_km_valloc_prefer_wait __P((vm_map_t, vsize_t,
voff_t));
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index aa5895fb37c..c9f9609104f 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_km.c,v 1.20 2001/11/07 02:55:50 art Exp $ */
-/* $NetBSD: uvm_km.c,v 1.40 2000/11/24 07:07:27 chs Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.21 2001/11/09 03:32:23 art Exp $ */
+/* $NetBSD: uvm_km.c,v 1.41 2000/11/27 04:36:40 nisimura Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -731,6 +731,15 @@ uvm_km_valloc(map, size)
vm_map_t map;
vsize_t size;
{
+ return(uvm_km_valloc_align(map, size, 0));
+}
+
+vaddr_t
+uvm_km_valloc_align(map, size, align)
+ vm_map_t map;
+ vsize_t size;
+ vsize_t align;
+{
vaddr_t kva;
UVMHIST_FUNC("uvm_km_valloc"); UVMHIST_CALLED(maphist);
@@ -745,7 +754,7 @@ uvm_km_valloc(map, size)
*/
if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
- UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL,
+ UVM_UNKNOWN_OFFSET, align, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL,
UVM_INH_NONE, UVM_ADV_RANDOM,
0)) != KERN_SUCCESS)) {
UVMHIST_LOG(maphist, "<- done (no VM)", 0,0,0,0);
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 46293b3b882..ad9b98c45f3 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_map.c,v 1.29 2001/11/07 02:55:50 art Exp $ */
-/* $NetBSD: uvm_map.c,v 1.85 2000/11/25 06:27:59 chs Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.30 2001/11/09 03:32:23 art Exp $ */
+/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -3265,16 +3265,16 @@ uvm_object_printit(uobj, full, pr)
}
}
-const char page_flagbits[] =
- "\20\4CLEAN\5BUSY\6WANTED\7TABLED\12FAKE\13FILLED\14DIRTY\15RELEASED"
- "\16FAULTING\17CLEANCHK";
-const char page_pqflagbits[] =
- "\20\1FREE\2INACTIVE\3ACTIVE\4LAUNDRY\5ANON\6AOBJ";
-
/*
* uvm_page_printit: actually print the page
*/
+static const char page_flagbits[] =
+ "\20\1BUSY\2WANTED\3TABLED\4CLEAN\5CLEANCHK\6RELEASED\7FAKE\10RDONLY"
+ "\11ZERO\15PAGER1";
+static const char page_pqflagbits[] =
+ "\20\1FREE\2INACTIVE\3ACTIVE\4LAUNDRY\5ANON\6AOBJ";
+
void
uvm_page_printit(pg, full, pr)
struct vm_page *pg;
@@ -3292,8 +3292,8 @@ uvm_page_printit(pg, full, pr)
snprintf(pqbuf, sizeof(pqbuf), "%b", pg->pqflags, page_pqflagbits);
(*pr)(" flags=%s, pqflags=%s, vers=%d, wire_count=%d, pa=0x%lx\n",
pgbuf, pqbuf, pg->version, pg->wire_count, (long)pg->phys_addr);
- (*pr)(" uobject=%p, uanon=%p, offset=0x%lx loan_count=%d\n",
- pg->uobject, pg->uanon, pg->offset, pg->loan_count);
+ (*pr)(" uobject=%p, uanon=%p, offset=0x%llx loan_count=%d\n",
+ pg->uobject, pg->uanon, (long long)pg->offset, pg->loan_count);
#if defined(UVM_PAGE_TRKOWN)
if (pg->flags & PG_BUSY)
(*pr)(" owning process = %d, tag=%s\n",
diff --git a/sys/uvm/uvm_map_i.h b/sys/uvm/uvm_map_i.h
index cac5159678e..c8f75e5f91a 100644
--- a/sys/uvm/uvm_map_i.h
+++ b/sys/uvm/uvm_map_i.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_map_i.h,v 1.8 2001/08/11 10:57:22 art Exp $ */
-/* $NetBSD: uvm_map_i.h,v 1.17 2000/05/08 22:59:35 thorpej Exp $ */
+/* $OpenBSD: uvm_map_i.h,v 1.9 2001/11/09 03:32:23 art Exp $ */
+/* $NetBSD: uvm_map_i.h,v 1.18 2000/11/27 08:40:04 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -196,16 +196,6 @@ MAP_INLINE void
uvm_map_reference(map)
vm_map_t map;
{
- if (__predict_false(map == NULL)) {
-#ifdef DIAGNOSTIC
- printf("uvm_map_reference: reference to NULL map\n");
-#ifdef DDB
- Debugger();
-#endif
-#endif
- return;
- }
-
simple_lock(&map->ref_lock);
map->ref_count++;
simple_unlock(&map->ref_lock);
@@ -224,20 +214,9 @@ uvm_map_deallocate(map)
{
int c;
- if (__predict_false(map == NULL)) {
-#ifdef DIAGNOSTIC
- printf("uvm_map_deallocate: reference to NULL map\n");
-#ifdef DDB
- Debugger();
-#endif
-#endif
- return;
- }
-
simple_lock(&map->ref_lock);
c = --map->ref_count;
simple_unlock(&map->ref_lock);
-
if (c > 0) {
return;
}
@@ -248,7 +227,6 @@ uvm_map_deallocate(map)
uvm_unmap(map, map->min_offset, map->max_offset);
pmap_destroy(map->pmap);
-
FREE(map, M_VMMAP);
}
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 22f0ceb9d3f..8e449bec4fa 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.25 2001/11/07 02:55:50 art Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.26 2001/11/09 03:32:23 art Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.45 2000/11/24 23:30:01 soren Exp $ */
/*
@@ -263,26 +263,6 @@ sys_mincore(p, v, retval)
return (error);
}
-#if 0
-/*
- * munmapfd: unmap file descriptor
- *
- * XXX: is this acutally a useful function? could it be useful?
- */
-
-void
-munmapfd(p, fd)
- struct proc *p;
- int fd;
-{
-
- /*
- * XXX should vm_deallocate any regions mapped to this file
- */
- p->p_fd->fd_ofileflags[fd] &= ~UF_MAPPED;
-}
-#endif
-
/*
* sys_mmap: mmap system call.
*
@@ -376,7 +356,9 @@ sys_mmap(p, v, retval)
* not fixed: make sure we skip over the largest possible heap.
* we will refine our guess later (e.g. to account for VAC, etc)
*/
- if (addr < round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ))
+
+ if (addr < round_page((vaddr_t)p->p_vmspace->vm_daddr +
+ MAXDSIZ))
addr = round_page((vaddr_t)p->p_vmspace->vm_daddr +
MAXDSIZ);
}
diff --git a/sys/uvm/uvm_page_i.h b/sys/uvm/uvm_page_i.h
index 6576d6b118b..8f2bf863753 100644
--- a/sys/uvm/uvm_page_i.h
+++ b/sys/uvm/uvm_page_i.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_page_i.h,v 1.8 2001/08/11 10:57:22 art Exp $ */
-/* $NetBSD: uvm_page_i.h,v 1.13 2000/05/08 23:11:53 thorpej Exp $ */
+/* $OpenBSD: uvm_page_i.h,v 1.9 2001/11/09 03:32:23 art Exp $ */
+/* $NetBSD: uvm_page_i.h,v 1.14 2000/11/27 07:47:42 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -134,16 +134,14 @@ uvm_pagelookup(obj, off)
s = splimp();
simple_lock(&uvm.hashlock);
- for (pg = buck->tqh_first ; pg != NULL ; pg = pg->hashq.tqe_next) {
+ TAILQ_FOREACH(pg, buck, hashq) {
if (pg->uobject == obj && pg->offset == off) {
- simple_unlock(&uvm.hashlock);
- splx(s);
- return(pg);
+ break;
}
}
simple_unlock(&uvm.hashlock);
splx(s);
- return(NULL);
+ return(pg);
}
/*
@@ -156,7 +154,6 @@ PAGE_INLINE void
uvm_pagewire(pg)
struct vm_page *pg;
{
-
if (pg->wire_count == 0) {
if (pg->pqflags & PQ_ACTIVE) {
TAILQ_REMOVE(&uvm.page_active, pg, pageq);
@@ -187,7 +184,6 @@ PAGE_INLINE void
uvm_pageunwire(pg)
struct vm_page *pg;
{
-
pg->wire_count--;
if (pg->wire_count == 0) {
TAILQ_INSERT_TAIL(&uvm.page_active, pg, pageq);
@@ -215,11 +211,7 @@ uvm_pagedeactivate(pg)
uvmexp.active--;
}
if ((pg->pqflags & PQ_INACTIVE) == 0) {
-#ifdef DIAGNOSTIC
- if (__predict_false(pg->wire_count))
- panic("uvm_pagedeactivate: caller did not check "
- "wire count");
-#endif
+ KASSERT(pg->wire_count == 0);
if (pg->pqflags & PQ_SWAPBACKED)
TAILQ_INSERT_TAIL(&uvm.page_inactive_swp, pg, pageq);
else
@@ -257,7 +249,7 @@ uvm_pageactivate(pg)
* can put it at tail. if it wasn't active, then mark
* it active and bump active count
*/
- if (pg->pqflags & PQ_ACTIVE)
+ if (pg->pqflags & PQ_ACTIVE)
TAILQ_REMOVE(&uvm.page_active, pg, pageq);
else {
pg->pqflags |= PQ_ACTIVE;
@@ -311,10 +303,7 @@ uvm_page_lookup_freelist(pg)
int lcv;
lcv = vm_physseg_find(atop(VM_PAGE_TO_PHYS(pg)), NULL);
-#ifdef DIAGNOSTIC
- if (__predict_false(lcv == -1))
- panic("uvm_page_lookup_freelist: unable to locate physseg");
-#endif
+ KASSERT(lcv != -1);
return (vm_physmem[lcv].free_list);
}