next up previous contents index
Next: 17 Simple Virtual Memory: Up: 16.8 API reference Previous: 16.8.19 amm_select: Returns an

16.8.20 amm_split_func: Split a map entry into two entries (user-provided callout)

 

SYNOPSIS

#include <oskit/amm.h>

int amm_split_func(amm_t *amm, amm_entry_t *entry, oskit_addr_t split_addr, [out] amm_entry_t **head, [out] amm_entry_t **tail);

DESCRIPTION

User-provided function called whenever the AMM needs to split an entry in map amm due to conflicting flags. The split function for an AMM is set at initialization time by passing a pointer to it as a parameter to amm_init_gen.

Entry is the entry to be split and split_addr is the address at which to split it. If the split is successful, head and tail are pointers to the resulting entries describing the ranges [amm_entry_start(entry) - split_addr-1] and [split_addr - amm_entry_end(entry)-1] respectively. Both may be entirely new entries allocated in this routine, or one may point to the modified original entry. The AMM will call the entry free function for the original entry if it is not one of the returned values.

This routine is responsible for initializing the map-private attributes of the resulting new entries.

If the split cannot be done, e.g., due to lack of resources, a non-zero value indicating the error should be returned. A non-zero return value is propagated on to whoever performed the action which triggered the split request.

amm_split_func is only called by amm_modify.

PARAMETERS

amm
A pointer to the amm_t structure representing the address map.
entry
The map entry to be split.
split_addr
The address at which to split the entry.
head,tail
Pointers to the the resulting new entries.

RETURNS

Returns zero if the split was successful, non-zero if not.

RELATED INFORMATION

amm_init_gen


University of Utah Flux Research Group