summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-13 19:37:40 +0000
committerwollman <wollman@FreeBSD.org>1997-02-13 19:37:40 +0000
commitcb442e2038f193d705318960fc919a03900c52d3 (patch)
tree99ed2ade0e822ace11ce4f53784815ac7cb9753e /sys/vm
parent7dfa42b35f6724f20741453d39ed365cfefd9272 (diff)
downloadFreeBSD-src-cb442e2038f193d705318960fc919a03900c52d3.zip
FreeBSD-src-cb442e2038f193d705318960fc919a03900c52d3.tar.gz
Provide an alternative interface to contigmalloc() which allows a specific
map to be used when allocating the kernel va (e.g., mb_map). The VM gurus may want to look this over.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_kern.h3
-rw-r--r--sys/vm/vm_page.c23
2 files changed, 22 insertions, 4 deletions
diff --git a/sys/vm/vm_kern.h b/sys/vm/vm_kern.h
index 32f924b..7ae0b0a 100644
--- a/sys/vm/vm_kern.h
+++ b/sys/vm/vm_kern.h
@@ -81,5 +81,8 @@ extern vm_map_t exech_map;
extern vm_map_t u_map;
extern vm_offset_t kernel_vm_end;
+/* XXX - elsewhere? */
+extern void *contigmalloc1(u_long, int, int, u_long, u_long, u_long, u_long,
+ vm_map_t);
#endif /* _VM_VM_KERN_H_ */
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 41cf3a3..f3a3131 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1271,7 +1271,7 @@ vm_page_test_dirty(m)
* for statistics and for allocations of less than a page.
*/
void *
-contigmalloc(size, type, flags, low, high, alignment, boundary)
+contigmalloc1(size, type, flags, low, high, alignment, boundary, map)
unsigned long size; /* should be size_t here and for malloc() */
int type;
int flags;
@@ -1279,6 +1279,7 @@ contigmalloc(size, type, flags, low, high, alignment, boundary)
unsigned long high;
unsigned long alignment;
unsigned long boundary;
+ vm_map_t map;
{
int i, s, start;
vm_offset_t addr, phys, tmp_addr;
@@ -1429,7 +1430,7 @@ again1:
* Allocate kernel VM, unfree and assign the physical pages to it and
* return kernel VM pointer.
*/
- tmp_addr = addr = kmem_alloc_pageable(kernel_map, size);
+ tmp_addr = addr = kmem_alloc_pageable(map, size);
if (addr == 0) {
/*
* XXX We almost never run out of kernel virtual
@@ -1454,6 +1455,20 @@ again1:
return NULL;
}
+void *
+contigmalloc(size, type, flags, low, high, alignment, boundary)
+ unsigned long size; /* should be size_t here and for malloc() */
+ int type;
+ int flags;
+ unsigned long low;
+ unsigned long high;
+ unsigned long alignment;
+ unsigned long boundary;
+{
+ return contigmalloc1(size, type, flags, low, high, alignment, boundary,
+ kernel_map);
+}
+
vm_offset_t
vm_page_alloc_contig(size, low, high, alignment)
vm_offset_t size;
@@ -1461,8 +1476,8 @@ vm_page_alloc_contig(size, low, high, alignment)
vm_offset_t high;
vm_offset_t alignment;
{
- return ((vm_offset_t)contigmalloc(size, M_DEVBUF, M_NOWAIT, low, high,
- alignment, 0ul));
+ return ((vm_offset_t)contigmalloc1(size, M_DEVBUF, M_NOWAIT, low, high,
+ alignment, 0ul, kernel_map));
}
#include "opt_ddb.h"
OpenPOWER on IntegriCloud