|
| 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 |
| |
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:
auto phys_range_1 = std::make_pair(phys1, size1);
auto phys_range_2 = std::make_pair(phys2, size2);
auto phys_range_3 = std::make_pair(phys3, size3);
auto list = {phys_range_1, phys_range_2, phys_range_3};
std::cout << bfn::make_unique_map_x64<char>(list) << '\n';
- Precondition
- expects: list.empty() == false
-
expects: list.at(i).first != 0
-
expects: list.at(i).second != 0
-
expects: list.at(i).second & (x64::page_size - 1) == 0
-
expects: attr != map_none
- Postcondition
- ensures: ret.get() != nullptr
- Parameters
-
| 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 |
- Returns
- resulting unique_map_ptr_x64
Definition at line 168 of file map_ptr_x64.h.
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.
- Note
- since this function must map in the guest's page tables to locate each physical address for each page being mapped, this function is very expensive, and should not be used in time critical operations.
Example:
std::cout << bfn::make_unique_map_x64<char>(
virt, vmcs::guest_cr3::get(),
size) <<
'\n';
- Precondition
- expects: virt != 0
-
expects: cr3 != 0
-
expects: size != 0
- Postcondition
- ensures: get() != nullptr
- Parameters
-
| 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 |
- Returns
- resulting unique_map_ptr_x64
Definition at line 222 of file map_ptr_x64.h.