template <class PagingTraits>

class Paging

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

Paging provides paging-related operations for a given a set of paging

traits.

Public Members

static const uint64_t kMaxPhysicalAddress
static const unsigned int kNumTableEntriesLog2
static const LevelType kFirstLevel
static const LevelType kLastLevel
static const uint64_t kTableAlignment
static const uint64_t kNumTableEntries
static const uint64_t kEntrySize
static const uint64_t kTableSize
static const uint64_t kPageSize
static const unsigned int kVirtualAddressSize
static optional kLowerVirtualAddressRangeEnd
static optional kUpperVirtualAddressRangeStart

Public Methods

template <typename PaddrToTableIo>
fit::result<fit::failed, PagingQueryResult> Query (uint64_t root_paddr, PaddrToTableIo && paddr_to_io, uint64_t vaddr)

A diagnostic utility that returns the page information associated with a

mapped virtual address `vaddr`. `fit::failed` is returned if a

non-present table entry was encountered.

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

template <typename PaddrToTableIo>
fit::result<fit::failed, PagingQueryResult> Query (uint64_t root_paddr, PaddrToTableIo && paddr_to_io, uint64_t vaddr)

A diagnostic utility that returns the page information associated with a

mapped virtual address `vaddr`. `fit::failed` is returned if a

non-present table entry was encountered.

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

template <typename PaddrToIoProvider, typename PageTableAllocator>
fit::result<MapError> Map (uint64_t root_paddr, PaddrToIoProvider && paddr_to_io, PageTableAllocator allocator, const SystemState & state, uint64_t input_vaddr, uint64_t size, uint64_t output_paddr, const MapSettings & settings)

Attempts to map `[input_vaddr, input_vaddr + size)` to

`[output_paddr, output_paddr + size)` with the provided settings.

`input_vaddr` and `output_vaddr` must both be aligned to the smallest

possible page size, and `size` must be a multiple of it. The mapping

must be a fresh one; this operation will return an error of type

`kAlreadyAllocated` if it encounters an existing mapping. The mapping

will proceed incrementally, mapping the largest possible page for each

increasing subrange.

Page table allocation is abstracted by an `PageTableAllocator` callable

with a signature of

```

std::optional

<uint64

_t>(uint64_t size, uint64_t alignment)

```

std::nullopt being returned in the event of an allocation failure.

`settings` represents the set of page-related settings to apply to a

new, zero-filled, terminal entry.

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

template <typename PaddrToIoProvider, typename PageTableAllocator>
fit::result<MapError> Map (uint64_t root_paddr, PaddrToIoProvider && paddr_to_io, PageTableAllocator allocator, const SystemState & state, uint64_t input_vaddr, uint64_t size, uint64_t output_paddr, const MapSettings & settings)

Attempts to map `[input_vaddr, input_vaddr + size)` to

`[output_paddr, output_paddr + size)` with the provided settings.

`input_vaddr` and `output_vaddr` must both be aligned to the smallest

possible page size, and `size` must be a multiple of it. The mapping

must be a fresh one; this operation will return an error of type

`kAlreadyAllocated` if it encounters an existing mapping. The mapping

will proceed incrementally, mapping the largest possible page for each

increasing subrange.

Page table allocation is abstracted by an `PageTableAllocator` callable

with a signature of

```

std::optional

<uint64

_t>(uint64_t size, uint64_t alignment)

```

std::nullopt being returned in the event of an allocation failure.

`settings` represents the set of page-related settings to apply to a

new, zero-filled, terminal entry.

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

template <typename PaddrToTableIo, typename Visitor>
VisitValue<Visitor, TableIo<PaddrToTableIo>> VisitPageTables (uint64_t table_paddr, PaddrToTableIo && paddr_to_io, Visitor && visitor, uint64_t vaddr)

Walk the page tables rooted at `table_paddr` for a given virtual address

and visitor.

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

template <typename PaddrToTableIo, typename Visitor>
VisitValue<Visitor, TableIo<PaddrToTableIo>> VisitPageTables (uint64_t table_paddr, PaddrToTableIo && paddr_to_io, Visitor && visitor, uint64_t vaddr)

Walk the page tables rooted at `table_paddr` for a given virtual address

and visitor.

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

Records