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).
This commit is contained in:
Dmitrij Tejblum 1999-06-08 17:03:28 +00:00
parent be960acd20
commit a839bdc8af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47841
2 changed files with 27 additions and 2 deletions

View File

@ -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));

View File

@ -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 $
*/
/*
@ -120,6 +120,30 @@ kmem_alloc_pageable(map, size)
return (addr);
}
/*
* 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.