template <LevelType Level>

struct TableEntry

Defined at line 148 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

The register type representing a page table entry at a given level. It

must meet the defined API below.

The underlying value type must be the same across all levels.

Public Methods

bool present ()

Whether the entry is present to the hardware.

The reading of an entry's settings while in the 'not present' state is

permitted, 'presence (to the hardware)' being regarding as orthogonal

in this case. It is assumed that `ValueType{0}` is in the 'not present'

state.

Defined at line 155 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool terminal ()

Whether the entry is terminal and points to the ultimate, physical page

(or block).

Defined at line 159 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

uint64_t address ()

Gives the physical address of the table at the next level or that of

the ultimate, physical page (or block) if the entry is terminal.

TODO(https://fxbug.dev/42079764): document required alignment.

Defined at line 165 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool readable ()

If the entry is terminal, these accessors give the access permissions

of the associated page (or block); if non-terminal, a false permission

flag here means that the flag is ignored in the entries at later

levels. In particular, that means that if the entry is non-terminal and

`!Traits::kNonTerminalAccessPermissions` then these accessors are

expected return identically true.

In the case of readability, writability, and executability, these

permissions constrain how the *supervisor* may access associated pages.

These permissions do not a priori indicate how usermode may access them

when `user_accessible()` is true; rather, the latter only indicates

usermode may access them in some fashion.

Defined at line 179 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool writable ()

Defined at line 180 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool executable ()

Defined at line 181 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool user_accessible ()

Defined at line 182 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool accessed ()

If terminal, whether the associated page was read from, written to, or

executed. If non-terminal, this *may* for certain implementations

indicate whether a page that maps through this entry was similarly

accessed; otherwise, this is expected to return false.

Hardware may often be configured so as to manage this bit

automatically - but otherwise software must do so and contend with

access faults when unset.

Defined at line 192 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

bool global ()

If terminal, whether the associated page is 'global'. A page being

designated as such prevents its TLB entries from being affected by

normal TLB invalidations. This is useful in the case of mappings that

are expected to exist within different page table trees being switched

between. If non-terminal, this is expected to return false.

Defined at line 199 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

MemoryType Memory (const SystemState & state)

Returns the memory type of the associated page, which may require

access to system state to decode.

This method may only be called on a terminal entry.

Defined at line 205 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h

TableEntry<Level> & Set (const SystemState & state, const PagingSettings & settings)

(Re)populates an entry as new. This is done in one go as there can be

interdependicies among the different aspects of entry state: these

could not otherwise be captured by individual setters with an

unconstrained relative call order. (For example, the setting of address

could be sensitive to whether the entry is terminal.)

If `settings.present` is false, all other settings should be ignored.

Once a setting is applied, the corresponding getter should return

reflect that identically.

If `settings.terminal` is true, then it is the responsibility of the

user to check that the provided access permissions are valid (e.g.,

in consultation with Traits::kExecuteOnlyAllowed) before making this

call; otherwise if `!Traits::kNonTerminalAccessPermissions` then the

provided access permissions are expected to be maximally permissive.

Where the qualifiers make sense (which is implementation-specific), a

call to Set() will result in a present entry being updated as accessed.

There is no case in which we would want to create a new

entry but not mark it as such. If hardware is managing these bits, then

there is no penalty to doing so; if software-managed, then we avoid an

unnecessary trap that we would only handle later on to set these bits.

Similarly, if an entry is Set() as writable, then it should reflect as

'dirty' when that makes sense.

Defined at line 235 of file ../../zircon/kernel/lib/arch/include/lib/arch/paging.h