Public Types | Public Member Functions
root_page_table_x64 Class Reference

Public Types

using pointer = void *
 
using integer_pointer = uintptr_t
 
using cr3_type = uint64_t
 
using attr_type = x64::memory_attr::attr_type
 
using size_type = size_t
 
using memory_descriptor_list = page_table_x64::memory_descriptor_list
 

Public Member Functions

 root_page_table_x64 (bool is_vmm=false)
 
virtual ~root_page_table_x64 ()=default
 
virtual cr3_type cr3 ()
 
virtual void map_1g (integer_pointer virt, integer_pointer phys, attr_type attr)
 
virtual void map_2m (integer_pointer virt, integer_pointer phys, attr_type attr)
 
virtual void map_4k (integer_pointer virt, integer_pointer phys, attr_type attr)
 
virtual void unmap (integer_pointer virt) noexcept
 
void setup_identity_map_1g (integer_pointer saddr, integer_pointer eaddr)
 
void setup_identity_map_2m (integer_pointer saddr, integer_pointer eaddr)
 
void setup_identity_map_4k (integer_pointer saddr, integer_pointer eaddr)
 
void unmap_identity_map_1g (integer_pointer saddr, integer_pointer eaddr)
 
void unmap_identity_map_2m (integer_pointer saddr, integer_pointer eaddr)
 
void unmap_identity_map_4k (integer_pointer saddr, integer_pointer eaddr)
 
page_table_entry_x64 virt_to_pte (integer_pointer virt) const
 
memory_descriptor_list pt_to_mdl () const
 
 root_page_table_x64 (root_page_table_x64 &&)=default
 
root_page_table_x64operator= (root_page_table_x64 &&)=default
 
 root_page_table_x64 (const root_page_table_x64 &)=delete
 
root_page_table_x64operator= (const root_page_table_x64 &)=delete
 

Detailed Description

Root Page Tables

The VMM has to have a set of page tables for itself to map in memory for itself, but also from other guests. This class represents the root page tables that the VMM will use.

Note that this class does not flush the TLB when modifications are made. This needs to be done manually. In general, this class should not be used directly, but instead mapping should be done via a unique_map_ptr_x64.

Definition at line 47 of file root_page_table_x64.h.

Member Typedef Documentation

◆ pointer

Definition at line 51 of file root_page_table_x64.h.

◆ integer_pointer

Definition at line 52 of file root_page_table_x64.h.

◆ cr3_type

Definition at line 53 of file root_page_table_x64.h.

◆ attr_type

Definition at line 54 of file root_page_table_x64.h.

◆ size_type

Definition at line 55 of file root_page_table_x64.h.

◆ memory_descriptor_list

Definition at line 56 of file root_page_table_x64.h.

Constructor & Destructor Documentation

◆ root_page_table_x64() [1/3]

root_page_table_x64::root_page_table_x64 ( bool  is_vmm = false)

Default Constructor

Precondition
expects: none
Postcondition
ensures: none

Definition at line 51 of file root_page_table_x64.cpp.

◆ ~root_page_table_x64()

virtual root_page_table_x64::~root_page_table_x64 ( )
virtualdefault

Default Destructor

Precondition
expects: none
Postcondition
ensures: none

◆ root_page_table_x64() [2/3]

root_page_table_x64::root_page_table_x64 ( root_page_table_x64 &&  )
default

◆ root_page_table_x64() [3/3]

root_page_table_x64::root_page_table_x64 ( const root_page_table_x64 )
delete

Member Function Documentation

◆ cr3()

root_page_table_x64::cr3_type root_page_table_x64::cr3 ( )
virtual

CR3

Precondition
expects: none
Postcondition
ensures: none
Returns
returns the cr3 value associated with this root page table

Definition at line 57 of file root_page_table_x64.cpp.

◆ map_1g()

virtual void root_page_table_x64::map_1g ( integer_pointer  virt,
integer_pointer  phys,
attr_type  attr 
)
inlinevirtual

Map (1 Gigabyte)

Maps 1 gigabyte of memory in the page tables given a virtual address, the physical address and a set of attributes.

Precondition
expects:
Postcondition
ensures:
Parameters
virtthe virtual address to map
physthe physical address to map the virt address
attrdescribes how to map the virt address

Definition at line 94 of file root_page_table_x64.h.

◆ map_2m()

virtual void root_page_table_x64::map_2m ( integer_pointer  virt,
integer_pointer  phys,
attr_type  attr 
)
inlinevirtual

Map (2 Megabytes)

Maps 1 gigabyte of memory in the page tables given a virtual address, the physical address and a set of attributes.

Precondition
expects:
Postcondition
ensures:
Parameters
virtthe virtual address to map
physthe physical address to map the virt address
attrdescribes how to map the virt address

Definition at line 109 of file root_page_table_x64.h.

◆ map_4k()

virtual void root_page_table_x64::map_4k ( integer_pointer  virt,
integer_pointer  phys,
attr_type  attr 
)
inlinevirtual

Map (1 Kilobytes)

Maps 1 gigabyte of memory in the page tables given a virtual address, the physical address and a set of attributes.

Precondition
expects:
Postcondition
ensures:
Parameters
virtthe virtual address to map
physthe physical address to map the virt address
attrdescribes how to map the virt address

Definition at line 124 of file root_page_table_x64.h.

◆ unmap()

void root_page_table_x64::unmap ( integer_pointer  virt)
virtualnoexcept

Unmap

Unmaps memory in the page tables give a virtual address.

Precondition
expects:
Postcondition
ensures:
Parameters
virtthe virtual address to unmap

Definition at line 61 of file root_page_table_x64.cpp.

◆ setup_identity_map_1g()

void root_page_table_x64::setup_identity_map_1g ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Setup Identify Map (1g Granularity)

Sets up an identify map in the page tables using 1 gigabyte of memory granularity.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 68 of file root_page_table_x64.cpp.

◆ setup_identity_map_2m()

void root_page_table_x64::setup_identity_map_2m ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Setup Identify Map (2m Granularity)

Sets up an identify map in the page tables using 1 gigabyte of memory granularity.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 79 of file root_page_table_x64.cpp.

◆ setup_identity_map_4k()

void root_page_table_x64::setup_identity_map_4k ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Setup Identify Map (4k Granularity)

Sets up an identify map in the page tables using 1 gigabyte of memory granularity.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 90 of file root_page_table_x64.cpp.

◆ unmap_identity_map_1g()

void root_page_table_x64::unmap_identity_map_1g ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Unmap Identify Map (1g Granularity)

Unmaps an identity map previously mapped using the setup_identity_map_1g function.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 101 of file root_page_table_x64.cpp.

◆ unmap_identity_map_2m()

void root_page_table_x64::unmap_identity_map_2m ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Unmap Identify Map (2m Granularity)

Unmaps an identity map previously mapped using the setup_identity_map_2m function.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 112 of file root_page_table_x64.cpp.

◆ unmap_identity_map_4k()

void root_page_table_x64::unmap_identity_map_4k ( integer_pointer  saddr,
integer_pointer  eaddr 
)

Unmap Identify Map (4k Granularity)

Unmaps an identity map previously mapped using the setup_identity_map_4k function.

Precondition
expects:
Postcondition
ensures:
Parameters
saddrthe starting address for the identify map
eaddrthe ending address for the identify map

Definition at line 123 of file root_page_table_x64.cpp.

◆ virt_to_pte()

page_table_entry_x64 root_page_table_x64::virt_to_pte ( integer_pointer  virt) const

Virtual Address To Page Table Entry

Locates the page table entry given a virtual address. The entry is guaranteed not to be null (or an exception is thrown). This function can be used to access a PTE, enabling the user to modify any part of the PTE as desired. It should be noted that the root page table owns the PTE. Unmapping a PTE invalidates the PTE returned by this function.

Precondition
expects:
Postcondition
ensures:
Parameters
virtthe virtual address to lookup
Returns
the resulting PTE

Definition at line 134 of file root_page_table_x64.cpp.

◆ pt_to_mdl()

root_page_table_x64::memory_descriptor_list root_page_table_x64::pt_to_mdl ( ) const

Page Table to Memory Descriptor List

This function converts the internal page table tree structure into a linear, memory descriptor list. Page table entry information is not provide, only the page tables. pages.

Precondition
expects:
Postcondition
ensures:
Returns
memory descriptor list

Definition at line 141 of file root_page_table_x64.cpp.

◆ operator=() [1/2]

root_page_table_x64& root_page_table_x64::operator= ( root_page_table_x64 &&  )
default

◆ operator=() [2/2]

root_page_table_x64& root_page_table_x64::operator= ( const root_page_table_x64 )
delete

The documentation for this class was generated from the following files: