class VmPageOrMarker

Defined at line 58 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 61 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

void ~VmPageOrMarker ()

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

void VmPageOrMarker (VmPageOrMarker && other)

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

void VmPageOrMarker (const VmPageOrMarker & )

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

VmPageOrMarker & operator= (const VmPageOrMarker & )

Defined at line 65 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 89 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 98 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

ReferenceValue Reference ()

Defined at line 105 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 112 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

ReferenceValue ReleaseReference ()

Defined at line 120 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 126 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 136 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 144 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Swap (VmPageOrMarker && other)

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

bool IsPage ()

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

bool IsMarker ()

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

bool IsEmpty ()

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

bool IsReference ()

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

bool IsPageOrRef ()

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

bool IsInterval ()

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

bool IsParentContent ()

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

VmPageOrMarker & operator= (VmPageOrMarker && other)

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

bool operator== (const VmPageOrMarker & other)

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

bool operator!= (const VmPageOrMarker & other)

Defined at line 178 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 181 of file ../../zircon/kernel/vm/include/vm/vm_page_list.h

VmPageOrMarker Marker ()

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

VmPageOrMarker ParentContent ()

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

VmPageOrMarker Page (vm_page * p)

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

VmPageOrMarker Reference (ReferenceValue ref)

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

bool IsIntervalStart ()

Getters and setters for the interval type.

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

bool IsIntervalEnd ()

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

bool IsIntervalSlot ()

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

bool IsIntervalZero ()

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

bool IsZeroIntervalClean ()

Getters and setter for the zero interval type.

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

bool IsZeroIntervalDirty ()

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

bool IsZeroIntervalUntracked ()

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

ZeroRange::DirtyState GetZeroIntervalDirtyState ()

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

void SetZeroIntervalAwaitingCleanLength (uint64_t len)

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

uint64_t GetZeroIntervalAwaitingCleanLength ()

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

Enumerations

enum IntervalType
Name Value
Zero 0
NumTypes 1

The types of sparse page interval types that are supported.

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

enum SentinelType
Name Value
Slot 0
Start 1
End 2
NumSentinels 3

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

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

Records

Friends

class VmPageList