41 std::map<memory_manager_x64::integer_pointer, memory_manager_x64::integer_pointer>
g_mapped;
42 std::map<memory_manager_x64::integer_pointer, bool>
g_unmapped;
70 for (
auto &element : dummy_pt_span)
111 setup_mm(MockRepository &mocks)
125 setup_pt(MockRepository &mocks)
141 memory_manager_ut::test_unique_map_ptr_x64_default_constructor()
148 memory_manager_ut::test_unique_map_ptr_x64_phys_constructor_invalid_args()
157 memory_manager_ut::test_unique_map_ptr_x64_phys_constructor_mm_map_fails()
159 MockRepository mocks;
161 auto &&
pt = setup_pt(mocks);
172 memory_manager_ut::test_unique_map_ptr_x64_phys_constructor_success()
174 MockRepository mocks;
196 memory_manager_ut::test_unique_map_ptr_x64_phys_range_constructor_invalid_args()
198 auto &&phys_range_1 = std::make_pair(0x1111000000000010UL,
x64::page_size * 2UL);
199 auto &&phys_range_2 = std::make_pair(0x1111000000004000UL,
x64::page_size * 2UL);
200 auto &&phys_range_3 = std::make_pair(0x1111000000008000UL,
x64::page_size * 2UL);
201 auto &&
list = {phys_range_1, phys_range_2, phys_range_3};
203 auto &&invalid_phys_range_1 = std::make_pair(0UL,
x64::page_size * 2UL);
204 auto &&invalid_phys_range_2 = std::make_pair(0x1111000000000010UL, 0UL);
205 auto &&invalid_phys_range_3 = std::make_pair(0x1111000000000010UL, 2UL);
206 auto &&invalid_list1 = {phys_range_1, invalid_phys_range_1, phys_range_3};
207 auto &&invalid_list2 = {phys_range_1, invalid_phys_range_2, phys_range_3};
208 auto &&invalid_list3 = {phys_range_1, invalid_phys_range_3, phys_range_3};
219 memory_manager_ut::test_unique_map_ptr_x64_phys_range_constructor_mm_map_fails()
221 MockRepository mocks;
223 auto &&
pt = setup_pt(mocks);
227 auto &&phys_range_1 = std::make_pair(0x1111000000000010UL,
x64::page_size * 2UL);
228 auto &&phys_range_2 = std::make_pair(0x1111000000004000UL,
x64::page_size * 2UL);
229 auto &&phys_range_3 = std::make_pair(0x1111000000008000UL,
x64::page_size * 2UL);
230 auto &&
list = {phys_range_1, phys_range_2, phys_range_3};
239 memory_manager_ut::test_unique_map_ptr_x64_phys_range_constructor_success()
241 MockRepository mocks;
245 auto &&phys_range_1 = std::make_pair(0x1111000000000010UL,
x64::page_size * 2UL);
246 auto &&phys_range_2 = std::make_pair(0x1111000000004000UL,
x64::page_size * 2UL);
247 auto &&phys_range_3 = std::make_pair(0x1111000000008000UL,
x64::page_size * 2UL);
248 auto &&
list = {phys_range_1, phys_range_2, phys_range_3};
257 auto &&phys1 = 0x1111000000000000UL;
258 auto &&phys2 = 0x1111000000001000UL;
259 auto &&phys3 = 0x1111000000004000UL;
260 auto &&phys4 = 0x1111000000005000UL;
261 auto &&phys5 = 0x1111000000008000UL;
262 auto &&phys6 = 0x1111000000009000UL;
300 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_invalid_args()
311 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_mm_map_fails()
313 MockRepository mocks;
315 auto &&
pt = setup_pt(mocks);
326 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_success_1g()
328 MockRepository mocks;
335 auto &&phys1 = 0x0000222200000000UL;
336 auto &&phys2 = 0x0000222200001000UL;
367 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_success_2m()
369 MockRepository mocks;
376 auto &&phys1 = 0x0000222200000000UL;
377 auto &&phys2 = 0x0000222200001000UL;
408 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_success_4k()
410 MockRepository mocks;
418 auto &&phys1 = 0x0000222200000000UL;
419 auto &&phys2 = 0x0000222200000000UL;
420 auto &&phys3 = 0x0000222200000000UL;
449 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_success_4k_aligned_addr()
451 MockRepository mocks;
459 auto &&phys1 = 0x0000222200000000UL;
460 auto &&phys2 = 0x0000222200000000UL;
489 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_success_4k_aligned_size()
491 MockRepository mocks;
499 auto &&phys1 = 0x0000222200000000UL;
500 auto &&phys2 = 0x0000222200000000UL;
529 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_not_present()
531 MockRepository mocks;
545 memory_manager_ut::test_unique_map_ptr_x64_virt_cr3_constructor_invalid_phys_addr()
547 MockRepository mocks;
561 memory_manager_ut::test_unique_map_ptr_x64_copy_constructor()
563 MockRepository mocks;
582 memory_manager_ut::test_unique_map_ptr_x64_move_operator_valid()
584 MockRepository mocks;
591 auto map2 = std::move(map1);
603 memory_manager_ut::test_unique_map_ptr_x64_move_operator_invalid()
605 MockRepository mocks;
624 memory_manager_ut::test_unique_map_ptr_x64_reference_operators()
649 memory_manager_ut::test_unique_map_ptr_x64_release()
651 MockRepository mocks;
670 memory_manager_ut::test_unique_map_ptr_x64_reset()
672 MockRepository mocks;
691 memory_manager_ut::test_unique_map_ptr_x64_swap()
693 MockRepository mocks;
700 auto &&phys1 = 0x1111000000000000UL;
701 auto &&phys2 = 0x1111000000001000UL;
719 memory_manager_ut::test_unique_map_ptr_x64_flush()
721 MockRepository mocks;
725 auto &&phys_range_1 = std::make_pair(0x1111000000000010UL,
x64::page_size * 2UL);
726 auto &&phys_range_2 = std::make_pair(0x1111000000004000UL,
x64::page_size * 2UL);
727 auto &&phys_range_3 = std::make_pair(0x1111000000008000UL,
x64::page_size * 2UL);
728 auto &&list = {phys_range_1, phys_range_2, phys_range_3};
754 memory_manager_ut::test_unique_map_ptr_x64_cache_flush()
756 MockRepository mocks;
760 auto &&phys_range_1 = std::make_pair(0x1111000000000010UL,
x64::page_size * 2UL);
761 auto &&phys_range_2 = std::make_pair(0x1111000000004000UL,
x64::page_size * 2UL);
762 auto &&phys_range_3 = std::make_pair(0x1111000000008000UL,
x64::page_size * 2UL);
763 auto &&list = {phys_range_1, phys_range_2, phys_range_3};
789 memory_manager_ut::test_unique_map_ptr_x64_comparison()
791 MockRepository mocks;
798 auto &&phys1 = 0x1111000000000000UL;
799 auto &&phys2 = 0x1111000000001000UL;
826 memory_manager_ut::test_unique_map_ptr_x64_make_failure()
828 MockRepository mocks;
835 this->
expect_exception([&]{ bfn::make_unique_map_x64<int>(
nullptr); },
""_ut_ffe);
839 this->
expect_exception([&]{ bfn::make_unique_map_x64<int>(0UL); },
""_ut_ffe);
843 this->
expect_exception([&]{ bfn::make_unique_map_x64<int>({std::make_pair(0UL, 0UL)}); },
""_ut_ffe);
847 this->
expect_exception([&]{ bfn::make_unique_map_x64<int>(0UL, 0UL, 0UL, 0UL); },
""_ut_ffe);
853 memory_manager_ut::test_virt_to_phys_with_cr3_invalid()
861 memory_manager_ut::test_virt_to_phys_with_cr3_1g()
863 MockRepository mocks;
880 memory_manager_ut::test_virt_to_phys_with_cr3_2m()
882 MockRepository mocks;
899 memory_manager_ut::test_virt_to_phys_with_cr3_4k()
901 MockRepository mocks;
virtual pointer alloc_map(size_type size) noexcept
#define expect_exception(f, e)
auto g_pte_valid_phys_addr
std::map< const void *, bool > g_cache_flushed
#define RUN_UNITTEST_WITH_MOCKS(a, b)
virtual size_type size() const noexcept
auto g_pte_large_page_reset
constexpr const auto num_entries
constexpr const auto invalid_virt
constexpr const auto phys_offset
void __invlpg(const void *virt) noexcept
constexpr const auto invalid_phys
#define expect_no_exception(f)
std::map< const void *, bool > g_freed
constexpr const auto valid_phys
constexpr const auto valid_virt
auto g_pte_large_page_count
void set_present(bool enabled) noexcept
constexpr const auto size
void uint64_t uint64_t uint64_t *rdx noexcept
virtual void map_4k(integer_pointer virt, integer_pointer phys, attr_type attr)
constexpr const auto addr
virtual void unmap(integer_pointer virt) noexcept
constexpr const auto rw_wb
auto make_ptr(const T ptr)
x64::memory_attr::attr_type read_write
static memory_manager_x64 * instance() noexcept
decltype(memory_descriptor::type) attr_type
void swap(unique_map_ptr_x64 &other) noexcept
constexpr page_table_x64::integer_pointer virt
constexpr const auto page_size
uintptr_t virt_to_phys_with_cr3(uintptr_t virt, uintptr_t cr3)
virtual pointer get() const noexcept
void reset(pointer ptr=pointer(), size_type size=size_type(), size_type unaligned_size=size_type()) noexcept
void __clflush(void *addr) noexcept
void cache_flush() noexcept
virtual void free_map(pointer ptr) noexcept
std::map< memory_manager_x64::integer_pointer, bool > g_unmapped
void swap(unique_map_ptr_x64< T > &x, unique_map_ptr_x64< T > &y) noexcept
uintptr_t integer_pointer
constexpr const auto valid_map
std::map< const void *, bool > g_flushed
std::map< memory_manager_x64::integer_pointer, memory_manager_x64::integer_pointer > g_mapped
root_page_table_x64 * root_pt() noexcept