next up previous contents index
Next: 16.8.3 amm_deallocate: Deallocate an Up: 16.8 API reference Previous: 16.8.1 amm_alloc_func: Allocate an

16.8.2 amm_allocate: Allocate an address range in an AMM (simple interface)

 

SYNOPSIS

#include <oskit/amm.h>

int amm_allocate(amm_t *amm, [in/out] oskit_addr_t *addrp, oskit_size_t size, int prot);

DESCRIPTION

Looks for a range of the indicated size with flags AMM_FREE and modifies it to have the attributes AMM_ALLOCATED|prot.

On call, *addrp specifies a hint address at which to start searching for a range of the desired size. The search will progress toward higher addresses from that point. If no range is found before the maximum possible address the search ``wraps around,'' starting from the lowest address and searching forward until it reaches the original hint address. If no free range of sufficient size is found, ENOMEM is returned.

Amm_allocate is a simplified interface to amm_modify intended to be used with amm_init, amm_deallocate, amm_protect, and amm_reserve.

PARAMETERS

amm
A pointer to the amm_t structure representing the address map.
addrp
On call, a pointer to the address at which to start searching. On return, the address chosen.
size
Size of the desired range.
prot
Additional attribute flags to associate with the range.

RETURNS

Returns zero if successful, an error code otherwise.

RELATED INFORMATION

amm_deallocate, amm_init, amm_modify, amm_protect, amm_reserve



University of Utah Flux Research Group