next up previous contents index
Next: 9.5.16 morecore: add memory Up: 9.5 Memory Allocation Previous: 9.5.14 smallocf: allocated uninitialized

9.5.15 smemalignf: allocate aligned memory with explicit size and LMM flags

   

SYNOPSIS

#include <oskit/c/malloc.h>

void *smemalignf(size_t alignment, size_t size, unsigned int flags);

DESCRIPTION

Allocate uninitialized memory with the specified byte alignment; e.g., an alignment value of 32 will return a block aligned on a 32-byte boundary. The interface is similar to smemalign but with an additional flags parameter which is passed to lmm_alloc. As with smemalign, the user must keep track of the size of the allocated chunk and pass that size to sfree when releasing the chunk.

For kernels running in the base environment on an x86, meaningful values for flags are as described in Section 10.11.1.

Note that the alignment is not the same as used by the underlying LMM routines. The alignment parameter in LMM calls is the number of low-order bits that should be zero in the returned pointer.

PARAMETERS

alignment
Desired byte-alignment of the returned block.
size
Size in bytes of desired allocation.
flags
Flags to pass to lmm_alloc.

RETURNS

Returns a pointer to the allocated memory or zero if none.



University of Utah Flux Research Group