allocate memory with specified physical properties
void *kmem_alloc_physreq(size_t size, physreq_t *preqp, int flag)
a specified amount of memory
with the physical address alignment
and contiguity properties specified by a
Number of bytes to allocate.
Pointer to a
Specifies whether the caller is willing to sleep waiting for memory.
If flag is set to KM_SLEEP, the caller will sleep,
if necessary, until the memory with the specified properties is available.
If flag is set to KM_NOSLEEP, the caller will not sleep,
but kmem_alloc_physreq will return NULL
if suitable memory is not immediately available.
Upon successful completion, kmem_alloc_physreq
returns a pointer to the allocated memory.
If size is set to 0, kmem_alloc_physreq returns NULL
regardless of the value of flag.
In DDI 8, the
structure is mostly used to allocate page-aligned memory
that is then passed to the
entry point routine
function in special-purpose drivers.
For setting up memory to use with scatter/gather operations,
DDI 8 drivers should use the
function or, for STREAMS drivers, the
The preqp argument points to a physreq structure,
previously allocated by
and prepped with
This structure is used to define physical address alignment
Drivers should call
as early as possible if contiguous memory
larger than one page is being requested,
preferably during driver initialization.
Due to randomization of the free page list,
physically contiguous pages might not be available
after the system has run at load for some time.
This could cause
to either fail (in the KM_NOSLEEP case)
or possibly wait forever (in the KM_SLEEP case).
is being requested.
Context and synchronization
If flag is set to KM_NOSLEEP,
non-blockable, initialization, or interrupt
If flag is set to KM_SLEEP,
This routine should not be called from driver
when contiguous memory larger than one page
6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
Differences between versions
In DDI versions prior to version 8,
is the preferred way to allocate memory
with specified physical characteristics,
especially when setting up scatter/gather operations.
The virtual address it returns
can be converted to a physical address with the
DDI 8 drivers should instead use the
function when allocating memory for scatter/gather operations.
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005