template <VmAddressRegionEnumeratorType, typename>
class VmAddressRegionEnumerator
Defined at line 40 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h
Helper class for performing enumeration of a VMAR. Although this is intended to be
internal, it is declared here for exposing to unit tests.
The purpose of having a stateful enumerator is to have the option to not need to hold the aspace
lock over the entire enumeration, whilst guaranteeing forward progress and termination. If the
vmar is modified whilst enumeration is paused (due to dropping the lock or otherwise) then it is
not well defined whether the enumerator will return any new mappings. However, the enumerator
will never return DEAD mappings, and will not return mappings in ranges it has already
enumerated.
Except between calls to |pause| and |resume|, the vmar should be considered immutable, and
sub-vmars and mappings should not be modified.
Public Methods
void VmAddressRegionEnumerator<value-parameter-0-0, type-parameter-0-1> (VMAR & vmar, vaddr_t min_addr, vaddr_t max_addr)
This requires the vmar lock to be held over the lifetime of the object, except where explicitly
stated otherwise.
Defined at line 49 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h
ktl::optional<NextResult> next ()
Yield the next region or mapping, or a nullopt if enumeration has completed. Regions are
yielded in depth-first pre-order. The regions are yielded as raw pointers, which are guaranteed
to be valid since the lock is held. It is the callers responsibility to keep these pointers
alive, by upgrading to RefPtrs or otherwise, if they want to |pause| and drop the lock.
Defined at line 77 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h
void pause ()
Pause enumeration. Until |resume| is called |next| may not be called, but the vmar lock is
permitted to be dropped, and the vmar is permitted to be modified.
Defined at line 149 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h
void resume ()
Resume enumeration allowing |next| to be called again.
Defined at line 176 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h
Lock<CriticalMutex> & lock_ref ()
Expose our backing lock for annotation purposes.
Defined at line 200 of file ../../zircon/kernel/vm/include/vm/vm_address_region_enumerator.h