SVR5
kmem_zalloc_physreq(D3)
kmem_zalloc_physreq --
allocate and clear memory with specified physical properties
Synopsis
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/ddi.h>
void *kmem_zalloc_physreq(size_t size, physreq_t *preqp, int flag)
Description
kmem_zalloc_physreq allocates size bytes of memory with the
physical address alignment and contiguity properties specified by preqp,
and then clear the memory by filling it with zeros.
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_zalloc_physreq will return NULL
if suitable memory is not immediately available.
Arguments
size-
Number of bytes to allocate.
preqp-
Pointer to a
physreq(D4)
structure.
flag-
Specifies whether the caller is willing to sleep waiting for memory.
Return values
Upon successful completion, kmem_zalloc_physreq
returns a pointer to the allocated memory.
If size is set to 0, kmem_zalloc_physreq returns NULL
regardless of the value of flag.
Usage
The preqp argument points to a physreq structure,
previously allocated by
physreq_alloc(D3).
This structure is used to define physical address alignment
requirements.
Warnings
Drivers should call kmem_zalloc_physreq 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 kmem_zalloc_physreq to either
fail (in the KM_NOSLEEP case) or possibly wait forever (in the
KM_SLEEP case).
This routine should not be called
during I/O transfers
when contiguous memory larger than one page
is being requested.
Context and synchronization
If flag is set to KM_NOSLEEP,
non-blockable, initialization, or interrupt
context.
If flag is set to KM_SLEEP,
user
context.
Hardware applicability
All
Version applicability
ddi:
6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
References
kmem_alloc(D3),
kmem_alloc_physreq(D3),
kmem_free(D3),
kmem_zalloc(D3),
physreq(D4)
physreq_alloc(D3),
physreq_prep(D3),
strategy(D2)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005