summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-06-08 17:03:28 +0000
committerdt <dt@FreeBSD.org>1999-06-08 17:03:28 +0000
commit309c487efd7aaa6300e27a2fedac55d365d7a5a7 (patch)
tree98f40617f3cf9da46329e620c40cbe008cbfe8f1 /sys
parent6f2e7884b67738b227642fd6afda105bdbc49a5d (diff)
downloadFreeBSD-src-309c487efd7aaa6300e27a2fedac55d365d7a5a7.zip
FreeBSD-src-309c487efd7aaa6300e27a2fedac55d365d7a5a7.tar.gz
Add a function kmem_alloc_nofault() - same as kmem_alloc_pageable(), but
create a nofault entry. It will be used to allocate kmem for upages. (I am not too happy with all this, but it's better than nothing).
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_extern.h3
-rw-r--r--sys/vm/vm_kern.c26
2 files changed, 27 insertions, 2 deletions
diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h
index 544ff30..93c9c60 100644
--- a/sys/vm/vm_extern.h
+++ b/sys/vm/vm_extern.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_extern.h 8.2 (Berkeley) 1/12/94
- * $Id: vm_extern.h,v 1.40 1999/01/26 02:49:52 julian Exp $
+ * $Id: vm_extern.h,v 1.41 1999/04/13 19:17:15 peter Exp $
*/
#ifndef _VM_EXTERN_H_
@@ -64,6 +64,7 @@ int grow __P((struct proc *, size_t));
int grow_stack __P((struct proc *, size_t));
int kernacc __P((caddr_t, int, int));
vm_offset_t kmem_alloc __P((vm_map_t, vm_size_t));
+vm_offset_t kmem_alloc_nofault __P((vm_map_t, vm_size_t));
vm_offset_t kmem_alloc_pageable __P((vm_map_t, vm_size_t));
vm_offset_t kmem_alloc_wait __P((vm_map_t, vm_size_t));
void kmem_free __P((vm_map_t, vm_offset_t, vm_size_t));
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index 16c6208..531dab2 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_kern.c,v 1.53 1999/03/12 08:05:49 alc Exp $
+ * $Id: vm_kern.c,v 1.54 1999/03/16 07:39:07 alc Exp $
*/
/*
@@ -121,6 +121,30 @@ kmem_alloc_pageable(map, size)
}
/*
+ * kmem_alloc_nofault:
+ *
+ * Same as kmem_alloc_pageable, except that it create a nofault entry.
+ */
+
+vm_offset_t
+kmem_alloc_nofault(map, size)
+ vm_map_t map;
+ register vm_size_t size;
+{
+ vm_offset_t addr;
+ register int result;
+
+ size = round_page(size);
+ addr = vm_map_min(map);
+ result = vm_map_find(map, NULL, (vm_offset_t) 0,
+ &addr, size, TRUE, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
+ if (result != KERN_SUCCESS) {
+ return (0);
+ }
+ return (addr);
+}
+
+/*
* Allocate wired-down memory in the kernel's address map
* or a submap.
*/
OpenPOWER on IntegriCloud