|
NAMEcontigmalloc , contigfree
—
manage contiguous kernel physical memory
SYNOPSIS#include <sys/types.h>
#include <sys/malloc.h>
void *
void
void *
DESCRIPTIONThecontigmalloc () function allocates
size bytes of contiguous physical memory that is aligned
to alignment bytes, and which does not cross a boundary
of boundary bytes. If successful, the allocation will
reside between physical addresses low and
high. The returned pointer points to a wired kernel
virtual address range of size bytes allocated from the
kernel virtual address (KVA) map.
The The flags parameter modifies
Other flags (if present) are ignored. The IMPLEMENTATION NOTESThecontigmalloc () function does not sleep waiting for
memory resources to be freed up, but instead actively reclaims pages before
giving up. However, unless M_NOWAIT is specified, it
may select a page for reclamation that must first be written to backing
storage, causing it to sleep.
The RETURN VALUESThecontigmalloc () function returns a kernel virtual
address if allocation succeeds, or NULL otherwise.
EXAMPLESvoid *p; p = contigmalloc(8192, M_DEVBUF, M_ZERO, 0, (1L << 22), 32 * 1024, 1024 * 1024); Ask for 8192 bytes of zero-filled memory residing between physical address 0 and 4194303 inclusive, aligned to a 32K boundary and not crossing a 1M address boundary. DIAGNOSTICSThecontigmalloc () function will panic if
size is zero, or if alignment or
boundary is not a power of two.
SEE ALSOmalloc(9), memguard(9)
Visit the GSP FreeBSD Man Page Interface. |