30 setup_mm(MockRepository &mocks)
32 auto descriptor_list =
51 memory_manager_ut::test_root_page_table_x64_init_failure()
54 auto &&mm = setup_mm(mocks);
66 memory_manager_ut::test_root_page_table_x64_init_success()
78 memory_manager_ut::test_root_page_table_x64_cr3()
84 this->
expect_true(root_cr3.cr3() == 0x0000000ABCDEF001B);
88 memory_manager_ut::test_root_page_table_x64_map_1g()
97 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
101 root_cr3.unmap(0x1000UL);
107 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
111 root_cr3.unmap(0x1000UL);
117 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
121 root_cr3.unmap(0x1000UL);
127 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
131 root_cr3.unmap(0x1000UL);
137 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
141 root_cr3.unmap(0x1000UL);
147 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
151 root_cr3.unmap(0x1000UL);
158 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
162 root_cr3.unmap(0x1000UL);
168 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
172 root_cr3.unmap(0x1000UL);
178 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
182 root_cr3.unmap(0x1000UL);
188 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
192 root_cr3.unmap(0x1000UL);
198 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
202 root_cr3.unmap(0x1000UL);
208 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
212 root_cr3.unmap(0x1000UL);
219 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
223 root_cr3.unmap(0x1000UL);
229 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
233 root_cr3.unmap(0x1000UL);
239 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
243 root_cr3.unmap(0x1000UL);
249 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
253 root_cr3.unmap(0x1000UL);
259 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
263 root_cr3.unmap(0x1000UL);
269 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
273 root_cr3.unmap(0x1000UL);
279 memory_manager_ut::test_root_page_table_x64_map_2m()
281 MockRepository mocks;
288 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
292 root_cr3.unmap(0x1000UL);
298 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
302 root_cr3.unmap(0x1000UL);
308 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
312 root_cr3.unmap(0x1000UL);
318 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
322 root_cr3.unmap(0x1000UL);
328 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
332 root_cr3.unmap(0x1000UL);
338 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
342 root_cr3.unmap(0x1000UL);
349 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
353 root_cr3.unmap(0x1000UL);
359 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
363 root_cr3.unmap(0x1000UL);
369 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
373 root_cr3.unmap(0x1000UL);
379 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
383 root_cr3.unmap(0x1000UL);
389 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
393 root_cr3.unmap(0x1000UL);
399 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
403 root_cr3.unmap(0x1000UL);
410 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
414 root_cr3.unmap(0x1000UL);
420 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
424 root_cr3.unmap(0x1000UL);
430 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
434 root_cr3.unmap(0x1000UL);
440 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
444 root_cr3.unmap(0x1000UL);
450 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
454 root_cr3.unmap(0x1000UL);
460 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
464 root_cr3.unmap(0x1000UL);
470 memory_manager_ut::test_root_page_table_x64_map_4k()
472 MockRepository mocks;
479 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
483 root_cr3.unmap(0x1000UL);
489 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
493 root_cr3.unmap(0x1000UL);
499 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
503 root_cr3.unmap(0x1000UL);
509 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
513 root_cr3.unmap(0x1000UL);
519 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
523 root_cr3.unmap(0x1000UL);
529 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
533 root_cr3.unmap(0x1000UL);
540 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
544 root_cr3.unmap(0x1000UL);
550 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
554 root_cr3.unmap(0x1000UL);
560 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
564 root_cr3.unmap(0x1000UL);
570 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
574 root_cr3.unmap(0x1000UL);
580 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
584 root_cr3.unmap(0x1000UL);
590 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
594 root_cr3.unmap(0x1000UL);
601 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
605 root_cr3.unmap(0x1000UL);
611 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
615 root_cr3.unmap(0x1000UL);
621 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
625 root_cr3.unmap(0x1000UL);
631 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
635 root_cr3.unmap(0x1000UL);
641 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
645 root_cr3.unmap(0x1000UL);
651 auto &&entry = root_cr3.virt_to_pte(0x1000UL);
655 root_cr3.unmap(0x1000UL);
661 memory_manager_ut::test_root_page_table_x64_map_invalid()
663 MockRepository mocks;
667 this->
expect_exception([&] { root_cr3.map_page(0x0, 0x0, 0x0, 0x0); },
""_ut_lee);
672 memory_manager_ut::test_root_page_table_x64_map_unmap_twice_success()
674 MockRepository mocks;
688 memory_manager_ut::test_root_page_table_x64_setup_identity_map_1g_invalid()
690 MockRepository mocks;
694 this->
expect_exception([&] { root_cr3.setup_identity_map_1g(0x1, 0x40000000); },
""_ut_ffe);
695 this->
expect_exception([&] { root_cr3.setup_identity_map_1g(0x0, 0x40000001); },
""_ut_ffe);
696 this->
expect_exception([&] { root_cr3.unmap_identity_map_1g(0x1, 0x40000000); },
""_ut_ffe);
697 this->
expect_exception([&] { root_cr3.unmap_identity_map_1g(0x0, 0x40000001); },
""_ut_ffe);
701 memory_manager_ut::test_root_page_table_x64_setup_identity_map_1g_valid()
703 MockRepository mocks;
712 memory_manager_ut::test_root_page_table_x64_setup_identity_map_2m_invalid()
714 MockRepository mocks;
718 this->
expect_exception([&] { root_cr3.setup_identity_map_2m(0x1, 0x200000); },
""_ut_ffe);
719 this->
expect_exception([&] { root_cr3.setup_identity_map_2m(0x0, 0x200001); },
""_ut_ffe);
720 this->
expect_exception([&] { root_cr3.unmap_identity_map_2m(0x1, 0x200000); },
""_ut_ffe);
721 this->
expect_exception([&] { root_cr3.unmap_identity_map_2m(0x0, 0x200001); },
""_ut_ffe);
725 memory_manager_ut::test_root_page_table_x64_setup_identity_map_2m_valid()
727 MockRepository mocks;
736 memory_manager_ut::test_root_page_table_x64_setup_identity_map_4k_invalid()
738 MockRepository mocks;
742 this->
expect_exception([&] { root_cr3.setup_identity_map_4k(0x1, 0x1000); },
""_ut_ffe);
743 this->
expect_exception([&] { root_cr3.setup_identity_map_4k(0x0, 0x1001); },
""_ut_ffe);
744 this->
expect_exception([&] { root_cr3.unmap_identity_map_4k(0x1, 0x1000); },
""_ut_ffe);
745 this->
expect_exception([&] { root_cr3.unmap_identity_map_4k(0x0, 0x1001); },
""_ut_ffe);
749 memory_manager_ut::test_root_page_table_x64_setup_identity_map_4k_valid()
751 MockRepository mocks;
760 memory_manager_ut::test_root_page_table_x64_pt_to_mdl()
762 MockRepository mocks;
#define expect_exception(f, e)
constexpr const auto pt_wp
virtual void add_md(integer_pointer virt, integer_pointer phys, attr_type attr)
virtual void map_2m(integer_pointer virt, integer_pointer phys, attr_type attr)
#define RUN_UNITTEST_WITH_MOCKS(a, b)
constexpr const auto re_wc
virtual integer_pointer virtint_to_physint(integer_pointer virt) const
virtual void map_1g(integer_pointer virt, integer_pointer phys, attr_type attr)
constexpr const auto re_wp
#define expect_no_exception(f)
constexpr const auto re_uc_m
constexpr const auto rw_uc_m
constexpr const auto pt_wb
virtual integer_pointer virtptr_to_physint(pointer virt) const
constexpr const auto re_wt
constexpr const auto size_bytes
virtual void map_4k(integer_pointer virt, integer_pointer phys, attr_type attr)
constexpr const auto rw_wb
constexpr const auto rw_uc
constexpr const auto pt_wt
static memory_manager_x64 * instance() noexcept
constexpr const auto re_uc
constexpr const auto pt_wc
constexpr const auto pt_uc
constexpr const auto rw_wc
constexpr const auto pt_uc_m
virtual memory_descriptor_list descriptors() const
virtual void remove_md(integer_pointer virt) noexcept
constexpr const auto rw_wt
constexpr const auto rw_wp
constexpr const auto re_wb
root_page_table_x64 * root_pt() noexcept