#include <oskit/lmm.h>void *lmm_alloc_gen(lmm_t *lmm, oskit_size_t size, lmm_flags_t flags, int align_bits, oskit_addr_t align_ofs, oskit_addr_t in_min, oskit_size_t in_size);
This routine allocates a memory block meeting various alignment and address constraints. It works like lmm_alloc_aligned, except that as an additional constraint, the returned memory block must fit entirely in the address range specified by the in_min and in_size parameters.If in_size is equal to size, then memory will only be allocated if a block can be found at exactly the address specified by in_min; i.e. the returned pointer will either be in_min or NULL.
- 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.
- in_min
- Start address of the address range in which to search for a free block. The returned memory block, if found, will have an address no lower than in_min.
- in_size
- Size of the address range in which to search for the free block. The returned memory block, if found, will fit entirely within this address range, so that .
Returns a pointer to the memory block allocated, or NULL if no memory block satisfying all of the specified requirements can be found.