class VmPageOrMarker

Defined at line 59 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

RAII helper for representing content in a page list node. This supports being in one of five

states

* Empty - Contains nothing.

* Page p - Contains a vm_page 'p'. This 'p' is considered owned by this wrapper and

`ReleasePage` must be called to give up ownership.

* Reference r - Contains a reference 'r' to some content. This 'r' is considered owned by this

wrapper and `ReleaseReference` must be called to give up ownership.

* Marker - Indicates that whilst not a page, it is also not empty. Markers can be used to

separate the distinction between "there's no page because we've deduped to the

zero page" (a `Marker` is inserted) and "there's no page because our parent

contains the content" (which is represented as `Empty`).

* Interval - Indicates that this page is part of a sparse page interval. An interval will

have a Start sentinel, and an End sentinel, and all offsets that lie between the

two will be empty. If the interval spans a single page, it will be represented

as a Slot sentinel, which is conceptually the same as both a Start and an End

sentinel.

* ParentContent - Indicates that there might be content for this slot, but the page list in the

parent must be checked for it. The different between `Empty`, which can also

indicate that the parent must be searched, and `ParentContent` is up to the

specific VMO.

There are certain invariants that the page list tries to maintain at all times. It might not

always be possible to enforce these as the checks involved might be expensive, however it is

important that any code that manipulates the page list abide by them, primarily to keep the

memory occupied by the page list nodes in check.

1. Page list nodes cannot be completely empty i.e. they must contain at least one non-empty slot.

2. Any intervals in the page list should span a maximal range. In other words, there should not

be consecutive intervals in the page list which it would have been possible to represent with a

single interval instead.

Public Methods

void VmPageOrMarker ()

A PageType that otherwise holds a null pointer is considered to be Empty.

Defined at line 62 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

void ~VmPageOrMarker ()

Defined at line 63 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

void VmPageOrMarker (VmPageOrMarker && other)

Defined at line 64 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

void VmPageOrMarker (const VmPageOrMarker & )

Defined at line 65 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker & operator= (const VmPageOrMarker & )

Defined at line 66 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

vm_page * Page ()

Returns a reference to the underlying vm_page*. Is only valid to call if `IsPage` is true.

Defined at line 90 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

paddr_t PageAsPaddr ()

Returns the paddr_t of the underlying vm_page*. Is only valid to call if `IsPage` is true. Can

be more efficient than performing |Page()->paddr()| as it saves a memory de-reference.

Defined at line 99 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

ReferenceValue Reference ()

Defined at line 106 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

vm_page * ReleasePage ()

If this is a page, moves the underlying vm_page* out and returns it. After this IsPage will

be false and IsEmpty will be true.

Defined at line 113 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

ReferenceValue ReleaseReference ()

Defined at line 121 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker::ReferenceValue SwapReferenceForPage (vm_page_t * p)

Changes the content from a reference to a page and returns the original reference.

Defined at line 127 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

vm_page_t * SwapPageForReference (VmPageOrMarker::ReferenceValue ref)

Changes the content from a page to a reference and returns the original page.

Defined at line 137 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker::ReferenceValue SwapReferenceForReference (VmPageOrMarker::ReferenceValue ref)

Changes the content from one reference to a different one and returns the original reference.

Defined at line 145 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Swap (VmPageOrMarker && other)

Defined at line 153 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsPage ()

Defined at line 159 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsMarker ()

Defined at line 160 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsEmpty ()

Defined at line 161 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsReference ()

Defined at line 165 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsPageOrRef ()

Defined at line 166 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsInterval ()

Defined at line 167 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsParentContent ()

Defined at line 168 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker & operator= (VmPageOrMarker && other)

Defined at line 170 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool operator== (const VmPageOrMarker & other)

Defined at line 177 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool operator!= (const VmPageOrMarker & other)

Defined at line 179 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Empty ()

A PageType that otherwise holds a null pointer is considered to be Empty.

Defined at line 182 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Marker ()

Defined at line 183 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker ParentContent ()

Defined at line 184 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Page (vm_page * p)

Defined at line 186 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Reference (ReferenceValue ref)

Defined at line 202 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsIntervalStart ()

Getters and setters for the interval type.

Defined at line 303 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsIntervalEnd ()

Defined at line 306 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsIntervalSlot ()

Defined at line 307 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsIntervalZero ()

Defined at line 310 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsZeroIntervalClean ()

Getters and setter for the zero interval type.

Defined at line 313 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsZeroIntervalDirty ()

Defined at line 318 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

bool IsZeroIntervalUntracked ()

Defined at line 323 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

ZeroRange::DirtyState GetZeroIntervalDirtyState ()

Defined at line 328 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

void SetZeroIntervalAwaitingCleanLength (uint64_t len)

Defined at line 332 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

uint64_t GetZeroIntervalAwaitingCleanLength ()

Defined at line 339 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

Enumerations

enum class IntervalType : uint32_t
Name Value Comments
Zero 0

Represents a range of zero pages.

NumTypes 1

Represents a range of zero pages.

The types of sparse page interval types that are supported.

Defined at line 211 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

enum class SentinelType : uint32_t
Name Value Comments
Slot 0

Represents a single page interval.

Start 1

The first page of a multi-page interval.

End 2

The last page of a multi-page interval.

NumSentinels 3

The last page of a multi-page interval.

Sentinel types that are used to represent a sparse page interval.

Defined at line 218 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

Records

Friends

class VmPageList