Data Structures | |
class | corrupt_vmm_error |
class | driver_inaccessible_error |
class | general_exception |
class | invalid_file_error |
class | invalid_vmm_state_error |
class | ioctl_failed_error |
class | missing_argument_error |
class | unique_map_ptr_x64 |
class | unknown_command_error |
class | unknown_status_error |
class | unknown_vmcall_data_type_error |
class | unknown_vmcall_string_type_error |
class | unknown_vmcall_type_error |
Functions | |
template<class T > | |
auto | make_unique_map_x64 (typename unique_map_ptr_x64< T >::pointer phys, x64::memory_attr::attr_type attr=x64::memory_attr::rw_wb) |
template<class T > | |
auto | make_unique_map_x64 (typename unique_map_ptr_x64< T >::integer_pointer phys, x64::memory_attr::attr_type attr=x64::memory_attr::rw_wb) |
template<class T > | |
auto | make_unique_map_x64 (const std::vector< std::pair< typename unique_map_ptr_x64< T >::integer_pointer, typename unique_map_ptr_x64< T >::size_type >> &list, x64::memory_attr::attr_type attr=x64::memory_attr::rw_wb) |
template<class T > | |
auto | make_unique_map_x64 (typename unique_map_ptr_x64< T >::integer_pointer virt, typename unique_map_ptr_x64< T >::integer_pointer cr3, typename unique_map_ptr_x64< T >::size_type size, x64::msrs::value_type pat) |
uintptr_t | virt_to_phys_with_cr3 (uintptr_t virt, uintptr_t cr3) |
void | map_with_cr3 (uintptr_t vmap, uintptr_t virt, uintptr_t cr3, size_t size, x64::msrs::value_type pat) |
template<class T > | |
void | swap (unique_map_ptr_x64< T > &x, unique_map_ptr_x64< T > &y) noexcept |
template<class T1 , class T2 > | |
bool | operator== (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T1 , class T2 > | |
bool | operator!= (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T1 , class T2 > | |
bool | operator< (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T1 , class T2 > | |
bool | operator<= (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T1 , class T2 > | |
bool | operator> (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T1 , class T2 > | |
bool | operator>= (const unique_map_ptr_x64< T1 > &x, const unique_map_ptr_x64< T2 > &y) |
template<class T > | |
bool | operator== (const unique_map_ptr_x64< T > &x, std::nullptr_t dontcare) noexcept |
template<class T > | |
bool | operator== (std::nullptr_t dontcare, const unique_map_ptr_x64< T > &y) noexcept |
template<class T > | |
bool | operator!= (const unique_map_ptr_x64< T > &x, std::nullptr_t dontcare) noexcept |
template<class T > | |
bool | operator!= (std::nullptr_t dontcare, const unique_map_ptr_x64< T > &y) noexcept |
void | __attribute__ ((weak)) map_with_cr3(uintptr_t vmap |
expects (lower(vmap)==0) | |
expects (virt !=0) | |
expects (cr3 !=0) | |
expects (lower(cr3)==0) | |
expects (size !=0) | |
for (auto offset=0UL;offset< size;offset+=x64::page_size) | |
template<class T , class = typename std::enable_if<std::is_integral<T>::value>::type> | |
std::string | to_string (const T val, const int base) |
template<class T > | |
auto | mock_no_delete (MockRepository &mocks) |
template<class T > | |
auto | mock_shared (MockRepository &mocks) |
template<class T > | |
auto | mock_unique (MockRepository &mocks) |
template<class T > | |
auto | lower (T ptr) noexcept |
template<class T > | |
auto | lower (T ptr, uintptr_t from) noexcept |
template<class T > | |
auto | upper (T ptr) noexcept |
template<class T > | |
auto | upper (T ptr, uintptr_t from) noexcept |
Variables | |
void uintptr_t | virt |
void uintptr_t uintptr_t | cr3 |
void uintptr_t uintptr_t size_t | size |
void uintptr_t uintptr_t size_t x64::msrs::value_type | pat |
auto bfn::make_unique_map_x64 | ( | typename unique_map_ptr_x64< T >::pointer | phys, |
x64::memory_attr::attr_type | attr = x64::memory_attr::rw_wb |
||
) |
Make Unique Map (Single Page)
This function can be used to map a single virtual memory page to a single physical memory page.
Example:
phys | the physical address to map |
attr | defines how to map the memory. Defaults to map_read_write |
Definition at line 75 of file map_ptr_x64.h.
auto bfn::make_unique_map_x64 | ( | typename unique_map_ptr_x64< T >::integer_pointer | phys, |
x64::memory_attr::attr_type | attr = x64::memory_attr::rw_wb |
||
) |
Make Unique Map (Single Page)
This function can be used to map a single virtual memory page to a single physical memory page.
Example:
phys | the physical address to map |
attr | defines how to map the memory. Defaults to map_read_write |
Definition at line 112 of file map_ptr_x64.h.
auto bfn::make_unique_map_x64 | ( | const std::vector< std::pair< typename unique_map_ptr_x64< T >::integer_pointer, typename unique_map_ptr_x64< T >::size_type >> & | list, |
x64::memory_attr::attr_type | attr = x64::memory_attr::rw_wb |
||
) |
Make Unique Map (Physically Contiguous / Non-Contiguous Range)
This function can be used to map both physically contiguous, and physically non-contiguous memory by providing a list of physical pages to map. The list consists of std::pairs, each containing a physical address, and a size. A physically contiguous memory range would consist of a list of one std::pair contains the physical address and it's size. A physically non-contiguous range would consist of a list of each page range that makes up the memory to be mapped (similar to a Windows MDL). In either case the total number of bytes mapped is equal to the total of each size field in each std::pair in the list provided.
Example:
list | list of std::pairs, each containing a physical address and a size, defining a physical address range to add to the virtual address mapping |
attr | defines how to map the memory. Defaults to map_read_write |
Definition at line 168 of file map_ptr_x64.h.
auto bfn::make_unique_map_x64 | ( | typename unique_map_ptr_x64< T >::integer_pointer | virt, |
typename unique_map_ptr_x64< T >::integer_pointer | cr3, | ||
typename unique_map_ptr_x64< T >::size_type | size, | ||
x64::msrs::value_type | pat | ||
) |
Make Unique Map (Physically Contiguous / Non-Contiguous Range With CR3)
This function can be used to map both physically contiguous, and physically non-contiguous memory by providing an existing virtually contiguous memory range address and size, as well as the CR3 value that defines the existing virtual to physical memory mappings. This is useful when mapping guest memory into VMM, and caution should be taken if mapping executable memory.
Example:
virt | the virtual address containing the existing mapping |
cr3 | the root page table containing the existing virtual to physical memory mappings |
size | the number of bytes to map |
pat | the pat msr associated with the provided cr3 |
Definition at line 222 of file map_ptr_x64.h.
|
inline |
Virt to Phys with CR3
Converts a virtual address to a physical address given the CR3 to locate the physical address from. Note that this function has to map / unmap the page table tree as it traverses the tree to locate the physical address. As a result, this is an expensive operation and should not be used in time sensitive operations.
virt | virtual address to convert |
cr3 | the CR3 to lookup the physical address from. The virtual address should originate from this CR3, otherwise the resulting physical address could be incorrect, or an exception could be thrown. |
Definition at line 919 of file map_ptr_x64.h.
void bfn::map_with_cr3 | ( | uintptr_t | vmap, |
uintptr_t | virt, | ||
uintptr_t | cr3, | ||
size_t | size, | ||
x64::msrs::value_type | pat | ||
) |
Map Physically Contiguous / Non-Contiguous Range With CR3
This function can be used to map both physically contiguous, and physically non-contiguous memory by providing an existing virtually contiguous memory range address and size, as well as the CR3 value that defines the existing virtual to physical memory mappings. This is useful when mapping guest memory into VMM, and caution should be taken if mapping executable memory.
vmap | the virtual address to map the range to |
virt | the virtual address containing the existing mapping |
cr3 | the root page table containing the existing virtual to physical memory mappings |
size | the number of bytes to map |
pat | the pat msr associated with the provided cr3 |
|
noexcept |
Definition at line 876 of file map_ptr_x64.h.
bool bfn::operator== | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 880 of file map_ptr_x64.h.
bool bfn::operator!= | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 884 of file map_ptr_x64.h.
bool bfn::operator< | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 888 of file map_ptr_x64.h.
bool bfn::operator<= | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 892 of file map_ptr_x64.h.
bool bfn::operator> | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 896 of file map_ptr_x64.h.
bool bfn::operator>= | ( | const unique_map_ptr_x64< T1 > & | x, |
const unique_map_ptr_x64< T2 > & | y | ||
) |
Definition at line 900 of file map_ptr_x64.h.
|
noexcept |
Definition at line 904 of file map_ptr_x64.h.
|
noexcept |
Definition at line 908 of file map_ptr_x64.h.
|
noexcept |
Definition at line 912 of file map_ptr_x64.h.
|
noexcept |
Definition at line 916 of file map_ptr_x64.h.
void bfn::__attribute__ | ( | (weak) | ) |
bfn::expects | ( | lower(vmap) | = =0 | ) |
bfn::expects | ( | virt ! | = 0 | ) |
bfn::expects | ( | cr3 ! | = 0 | ) |
bfn::expects | ( | size ! | = 0 | ) |
bfn::for | ( | ) |
Definition at line 45 of file map_ptr_x64.cpp.
std::string bfn::to_string | ( | const T | val, |
const int | base | ||
) |
Get a std::string representation of an interger
val | Integer to get a std::string representation of |
base | The base to format the std::string representation |
Definition at line 42 of file to_string.h.
auto bfn::mock_no_delete | ( | MockRepository & | mocks | ) |
Mock No Delete
If the destructor of the class is called, this function prevents a crash by registering a call to the destructor to do nothing.
Definition at line 272 of file unittest.h.
auto bfn::mock_shared | ( | MockRepository & | mocks | ) |
Mock Shared
Use this function to create a mocked version of a shared pointer.
Definition at line 290 of file unittest.h.
auto bfn::mock_unique | ( | MockRepository & | mocks | ) |
Mock Unique
Use this function to create a mocked version of a unique pointer.
Definition at line 303 of file unittest.h.
|
noexcept |
Lower
ptr | the pointer to mask |
Definition at line 36 of file upper_lower.h.
|
noexcept |
Lower
ptr | the pointer to mask |
from | the number of bits to mask |
Definition at line 46 of file upper_lower.h.
|
noexcept |
Upper
ptr | the pointer to mask |
Definition at line 55 of file upper_lower.h.
|
noexcept |
Upper
ptr | the pointer to mask |
from | the number of bits to mask |
Definition at line 65 of file upper_lower.h.
void uintptr_t bfn::virt |
Definition at line 33 of file map_ptr_x64.cpp.
void uintptr_t uintptr_t bfn::cr3 |
Definition at line 33 of file map_ptr_x64.cpp.
void uintptr_t uintptr_t size_t bfn::size |
Definition at line 33 of file map_ptr_x64.cpp.
void uintptr_t uintptr_t size_t x64::msrs::value_type bfn::pat |
Definition at line 37 of file map_ptr_x64.cpp.