#include <oskit/amm.h>int amm_iterate_gen(amm_t *amm, int (*amm_iterate_func)(), void *arg, oskit_addr_t addr, oskit_size_t size, int flags, int flagmask);
Calls a user-provided function amm_iterate_func for every entry of amm which falls partially or completely in the range [addr - addr+size-1] and matches the given attribute criteria.Arg is an opaque value which is passed to every instance of amm_iterate_func (along with amm and the entry itself).
Flags and flagmask specify the attributes that an entry in the range must match for amm_iterate_func to be invoked. Only entries with ((entry->flags & flagmask) == flags) are considered.
amm_iterate_gen continues until the function has been called for all appropriate entries in the range or until one instance of the function returns non-zero. In the latter case, that non-zero value will be returned from amm_iterate_gen.
Since the iteration function may modify or even destroy the entry passed in, amm_iterate_gen uses the following technique for locating the ``next'' entry. At the beginning of each iteration, amm_iterate_gen records the last address covered by the current entry. After the specified iteration function returns, amm_find_addr is called with this address to ``relocate'' the current entry. From this entry, amm_iterate_gen derives the next entry.
- amm
- A pointer to the amm_t structure representing the address map.
- amm_iterate_func
- Function to be called for every matching entry.
- arg
- Argument to be passed to every instance of the iteration function.
- addr
- Address at which to start iterating.
- size
- Size of the desired range over which to iterate.
- flags
- Attribute flags that an entry must possess after masking with flagmask.
- flagmask
- Attribute mask to bitwise-AND with when matching an entry.
Returns zero if amm_iterate_func returned zero for all entries. Returns the first non-zero value returned from any amm_iterate_func call.
amm_iterate_func