#include #pragma once extern "C" void dump_address(); struct page_table { uint32_t* addr; }; class vmm { public: vmm(uint32_t* addr = nullptr); constexpr static size_t table_id(uint32_t offset) { offset &= 0xfff00000; offset /= (4 * 1024 * 1024); return static_cast(offset); } constexpr static size_t page_id(uint32_t offset) { return static_cast(offset / 4096); } uint32_t map(uint32_t phys_addr, uint32_t offset); private: uint32_t* directory; }; static_assert(vmm::table_id(0x00001234) == 0); static_assert(vmm::table_id(0x00400000) == 1); static_assert(vmm::table_id(0xc0000000) == 768); static_assert(vmm::table_id(0xc03ff000) == 768);