next up previous contents index
Next: 16.6 Generic interface example Up: 16 Address Map Manager: Previous: 16.4 Simple interface

16.5 Generic interface

 

The more general AMM interface routines provide the same basic capability as the simple interface. amm_init_gen provides the one-time initialization of a map, amm_find_gen locates an address range in a map, amm_modify changes the attributes of an address range, and amm_iterate_gen allows a user-provided function to be called for selected entries in a map.

The primary differences between the two interfaces are that the generic interface allows fine-grained control over the selection of addresses and attributes within a map and it permits user-directed allocation and management of address map entries.

Fine-grained control of address selection enables the user to specify exact alignment and offset criteria when attempting to find a range of addresses in a map using amm_find_gen. For example, an address space manager can allocate arbitrary-sized, page-aligned address ranges using this technique.

Similarly, fine-grained control of attribute selection enables inexact attribute matches when locating an address range using amm_find_gen. In the address space manager example, this would allow an address space deallocation routine to match any allocated map entry regardless of its additional protection bits. These mask and match parameters are also used in amm_iterate_gen to selectively iterate over entries in a map.

User-directed allocation and management of entries allows the user to embed the standard amm_entry_t structure in a larger application specific structure thus associating additional state with each entry. Allocation control is addressed in two ways. First, is by providing explicit map entry parameters to amm_init_gen and amm_modify, the two routines that result in an entry being added to a map. In this way, the caller can pass in the wrapped amm_entry_t structure to use. Second, as part of the amm_init_gen call, the user can register a routine to be called when a map entry is to be split. Since entry splitting results in one or two new entries being created, this routine allows the user to provide the wrapped entries to use.

User-directed management is attained through the above allocation hooks as well as additional initialization-time registered callback routines for joining and deallocation of map entries. The join routine permits the user to determine if two entries which are adjacent in address and have equivalent attributes flags can be coalesced into a single entry. If they can be joined, this routine is responsible for merging the extended attribute information and returning a new entry with this state. The deallocation routine enables user control over situations where the AMM library destroys map entries, either left over entries from a join operation or entries that are completely replaced by a single entry in amm_modify. This routine is responsible for freeing the extended attribute information.


next up previous contents index
Next: 16.6 Generic interface example Up: 16 Address Map Manager: Previous: 16.4 Simple interface

University of Utah Flux Research Group