template <class T>

class X86PageTableImpl

Defined at line 321 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

Implementation of the X86 page table code, that is expected to be derived using the recursive

template pattern. The derived class T is expected to implement the following methods:

Returns the highest level of the page tables

PageTableLevel top_level();

Returns true if the given ARCH_MMU_FLAG_* flag combination is valid.

bool allowed_flags(uint flags);

Returns true if the given paddr is valid

bool check_paddr(paddr_t paddr);

Returns true if the given vaddr is valid

bool check_vaddr(vaddr_t vaddr);

Whether the processor supports the page size of this level

bool supports_page_size(PageTableLevel level);

Return the hardware flags to use on intermediate page tables entries

IntermediatePtFlags intermediate_flags();

Return the hardware flags to use on terminal page table entries

PtFlags terminal_flags(PageTableLevel level, uint flags);

Return the hardware flags to use on smaller pages after a splitting a

large page with flags |flags|.

PtFlags split_flags(PageTableLevel level, PtFlags flags);

Execute the given pending invalidation

void TlbInvalidate(const PendingTlbInvalidation* pending);

Convert PtFlags to ARCH_MMU_* flags.

uint pt_flags_to_mmu_flags(PtFlags flags, PageTableLevel level);

Returns true if a cache flush is necessary for pagetable changes to be

visible to hardware page table walkers. On x86, this is only true for Intel IOMMU page

tables when the IOMMU 'caching mode' bit is true.

bool needs_cache_flushes();

Public Methods

void X86PageTableImpl<T> ()

Defined at line 323 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

X86PageTableBase * get_shared_pt ()

Accessors for the shared and restricted page tables on a unified page table.

We can turn off thread safety analysis as these accessors should only be used on unified page

tables, for which both the shared and restricted page table pointers are notionally const.

Defined at line 328 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

X86PageTableBase * get_restricted_pt ()

Defined at line 332 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

X86PageTableBase * get_unified_pt ()

Accessor for the unified page table from a restricted page table.

Thread safety analysis is left on for this accessor because the unified page table pointer is

set during creation of the unified page table, which happens after this restricted page table

is already created.

Defined at line 341 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t MapPages (vaddr_t vaddr, paddr_t * phys, size_t count, uint mmu_flags, ExistingEntryAction existing_action)

Defined at line 346 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t MapPagesContiguous (vaddr_t vaddr, paddr_t paddr, const size_t count, uint mmu_flags)

Defined at line 392 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t UnmapPages (vaddr_t vaddr, const size_t count, ArchUnmapOptions enlarge)

Defined at line 435 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t ProtectPages (vaddr_t vaddr, size_t count, uint mmu_flags)

Defined at line 458 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t QueryVaddr (vaddr_t vaddr, paddr_t * paddr, uint * mmu_flags)

Defined at line 484 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t HarvestAccessed (vaddr_t vaddr, size_t count, NonTerminalAction non_terminal_action, TerminalAction terminal_action)

Defined at line 527 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

uint CountPresentEntries (const volatile pt_entry_t * page_table)

Defined at line 550 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

Protected Methods

zx_status_t InitRestricted (void * ctx, page_alloc_fn_t test_paf)

We disable analysis due to the write to |pages_| tripping it up. It is safe

to write to |pages_| since this is part of object construction.

Initialize an empty page table and mark it as restricted.

Defined at line 564 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t InitShared (void * ctx, vaddr_t base, size_t size, page_alloc_fn_t test_paf)

Initialize a page table, assign the given context, and prepopulate the top level page table

entries.

We disable analysis due to the write to |pages_| tripping it up. It is safe

to write to |pages_| since this is part of object construction.

Defined at line 572 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

zx_status_t InitUnified (void * ctx, X86PageTableImpl<T> * shared, vaddr_t shared_base, size_t shared_size, X86PageTableImpl<T> * restricted, vaddr_t restricted_base, size_t restricted_size, page_alloc_fn_t test_paf)

Initialize a page table, assign the given context, and set it up as a unified page table with

entries from the given page tables.

The shared and restricted page tables must satisfy the following requirements:

1) The shared page table must set only |is_shared_| to true.

2) The restricted page table must set only |is_restricted_| to true.

3) Both the shared and restricted page tables must have been initialized prior to this call.

Defined at line 608 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h

void Destroy (vaddr_t base, size_t size)

Calls DestroyUnified if this is a unified page table and DestroyIndividual if it is not.

Defined at line 678 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h