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(arch_mmu_flags_t 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, arch_mmu_flags_t 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.
arch_mmu_flags_t 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_tvaddr,paddr_t *phys,size_tcount,arch_mmu_flags_tmmu_flags,ExistingEntryActionexisting_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_tvaddr,paddr_tpaddr,const size_tcount,arch_mmu_flags_tmmu_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_tvaddr,const size_tcount,ArchUnmapOptionsenlarge)
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_tvaddr,size_tcount,arch_mmu_flags_tmmu_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_tvaddr,paddr_t *paddr,arch_mmu_flags_t *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_tvaddr,size_tcount,NonTerminalActionnon_terminal_action,TerminalActionterminal_action)
Defined at line 528 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 551 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 565 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h
zx_status_t InitShared (void *ctx,vaddr_tbase,size_tsize,page_alloc_fn_ttest_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 573 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_tshared_base,size_tshared_size,X86PageTableImpl<T> *restricted,vaddr_trestricted_base,size_trestricted_size,page_alloc_fn_ttest_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 609 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 679 of file ../../zircon/kernel/arch/x86/page_tables/include/arch/x86/page_tables/page_tables.h