#include <oskit/lmm.h>void *lmm_alloc_aligned(lmm_t *lmm, oskit_size_t size, lmm_flags_t flags, int align_bits, oskit_addr_t align_ofs);
This routine allocates a memory block with specific alignment constraints. It works like lmm_alloc, except that it enforces the rule that the lowest align_bits bits of the address of the returned block must match the lowest align_bits of align_ofs. In other words, align_bits specifies an alignment boundary as a power of two, and align_ofs specifies an offset from ``natural'' alignment. If no memory block with the proper requirements can be found, then this function returns NULL instead.
- lmm
- The memory pool from which to allocate.
- size
- The number of contiguous bytes of memory needed.
- flags
- The memory type required for this allocation. For each bit set in the flags parameter, the corresponding bit in a region's flags word must also be set in order for the region to be considered for allocation. If the flags parameter is zero, memory will be allocated from any region.
- align_bits
- The number of low bits of the returned memory block address that must match the corresponding bits in align_ofs.
- align_ofs
- The required offset from natural power-of-two alignment. If align_ofs is zero, then the returned memory block will be naturally aligned on a
boundary.
Returns a pointer to the memory block allocated, or NULL if no memory block satisfying the specified requirements can be found.