contigmalloc(9) and contigfree(9) are now implemented in terms of other
more general VM system interfaces. So, their implementation can now reside in kern_malloc.c alongside the other functions that are declared in malloc.h.
This commit is contained in:
parent
9eaf5975ff
commit
0a7d6450d6
@ -407,6 +407,43 @@ malloc_type_freed(struct malloc_type *mtp, unsigned long size)
|
||||
critical_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* contigmalloc:
|
||||
*
|
||||
* Allocate a block of physically contiguous memory.
|
||||
*
|
||||
* If M_NOWAIT is set, this routine will not block and return NULL if
|
||||
* the allocation fails.
|
||||
*/
|
||||
void *
|
||||
contigmalloc(unsigned long size, struct malloc_type *type, int flags,
|
||||
vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
|
||||
unsigned long boundary)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high,
|
||||
alignment, boundary, VM_MEMATTR_DEFAULT);
|
||||
if (ret != NULL)
|
||||
malloc_type_allocated(type, round_page(size));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* contigfree:
|
||||
*
|
||||
* Free a block of memory allocated by contigmalloc.
|
||||
*
|
||||
* This routine may not block.
|
||||
*/
|
||||
void
|
||||
contigfree(void *addr, unsigned long size, struct malloc_type *type)
|
||||
{
|
||||
|
||||
kmem_free(kernel_map, (vm_offset_t)addr, size);
|
||||
malloc_type_freed(type, round_page(size));
|
||||
}
|
||||
|
||||
/*
|
||||
* malloc:
|
||||
*
|
||||
|
@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/proc.h>
|
||||
@ -334,25 +333,6 @@ contigmapping(vm_map_t map, vm_size_t size, vm_page_t m, vm_memattr_t memattr,
|
||||
return (addr);
|
||||
}
|
||||
|
||||
void *
|
||||
contigmalloc(
|
||||
unsigned long size, /* should be size_t here and for malloc() */
|
||||
struct malloc_type *type,
|
||||
int flags,
|
||||
vm_paddr_t low,
|
||||
vm_paddr_t high,
|
||||
unsigned long alignment,
|
||||
unsigned long boundary)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high,
|
||||
alignment, boundary, VM_MEMATTR_DEFAULT);
|
||||
if (ret != NULL)
|
||||
malloc_type_allocated(type, round_page(size));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
vm_offset_t
|
||||
kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low,
|
||||
vm_paddr_t high, unsigned long alignment, unsigned long boundary,
|
||||
@ -382,11 +362,3 @@ retry:
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void
|
||||
contigfree(void *addr, unsigned long size, struct malloc_type *type)
|
||||
{
|
||||
|
||||
kmem_free(kernel_map, (vm_offset_t)addr, size);
|
||||
malloc_type_freed(type, round_page(size));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user