class MappingProtectionRanges

Defined at line 818 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

Helper object for managing a WAVL tree of protection ranges inside a VmMapping. For efficiency

this object does not duplicate the base_ and size_ of the mapping, and so these values must be

passed into most methods as |mapping_base| and |mapping_size|.

This object is thread-compatible

TODO: This object could be generalized into a dense range tracker as it is not really doing

anything mapping specific.

Public Methods

void MappingProtectionRanges (uint arch_mmu_flags)

Defined at line 820 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

void MappingProtectionRanges (MappingProtectionRanges && )

Defined at line 822 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

void ~MappingProtectionRanges ()

Defined at line 823 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

MappingProtectionRanges & operator= (MappingProtectionRanges && )

Defined at line 824 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

FlagsRange FlagsRangeAtAddr (vaddr_t mapping_base, size_t mapping_size, vaddr_t vaddr)

Returns both the flags for the specified vaddr, as well as the end of the range those flags are

valid for.

Defined at line 833 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

template <typename F>
zx_status_t EnumerateProtectionRanges (vaddr_t mapping_base, size_t mapping_size, vaddr_t base, size_t size, F func)

Enumerates any different protection ranges that exist inside this mapping. The virtual range

specified by range_base and range_size must be within this mappings base_ and size_. The

provided callback is called in virtual address order for each protection type. ZX_ERR_NEXT

and ZX_ERR_STOP can be used to control iteration, with any other status becoming the return

value of this method. The callback |func| is assumed to have a type signature of:

|zx_status_t(vaddr_t region_base, size_t region_size, uint mmu_flags)|

Defined at line 859 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

void clear ()

Clears all protection information and sets the size to 0.

Defined at line 928 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

uint FirstRegionMmuFlags ()

Flags for the first protection region.

Defined at line 931 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

bool IsSingleRegion ()

Returns whether there is only a single protection region, that being the first region.

Defined at line 934 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

void SetFirstRegionMmuFlags (uint32_t new_flags)

Sets the flags for the first region

Defined at line 937 of file ../../zircon/kernel/vm/include/vm/vm_address_region.h

template <typename F>
zx_status_t UpdateProtectionRange (vaddr_t mapping_base, size_t mapping_size, vaddr_t base, size_t size, uint new_arch_mmu_flags, F callback)

Updates the specified inclusive sub range to have the given flags. On error state is unchanged.

When updating the provided callback is invoked for every old range and value that is being

modified.

Defined at line 1561 of file ../../zircon/kernel/vm/vm_mapping.cc

zx_status_t MergeRightNeighbor (MappingProtectionRanges & right, vaddr_t merge_addr)

Merges protection ranges such that |right| is left cleared, and |this| contains the information

of both ranges. It is an error to call this if |this| and |right| are not virtually contiguous.

Defined at line 1714 of file ../../zircon/kernel/vm/vm_mapping.cc

MappingProtectionRanges SplitAt (vaddr_t split)

Splits this protection range into two ranges around the specified split point. |this| becomes

the left range and the right range is returned.

Defined at line 1738 of file ../../zircon/kernel/vm/vm_mapping.cc

void DiscardBelow (vaddr_t addr)

Discard any protection information below the given address.

Defined at line 1752 of file ../../zircon/kernel/vm/vm_mapping.cc

void DiscardAbove (vaddr_t addr)

Discard any protection information above the given address.

Defined at line 1759 of file ../../zircon/kernel/vm/vm_mapping.cc

bool DebugNodesWithinRange (vaddr_t mapping_base, size_t mapping_size)

Returns whether all the protection nodes are within the given range. Intended for asserts.

Defined at line 1766 of file ../../zircon/kernel/vm/vm_mapping.cc

Records