|
|
|
@ -201,15 +201,16 @@ namespace nasa
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<ppte, pte> mem_ctx::get_pte(void* addr, bool use_hyperspace)
|
|
|
|
|
auto mem_ctx::get_pte(void* addr, bool use_hyperspace) -> std::pair<ppte, pte>
|
|
|
|
|
{
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return {};
|
|
|
|
|
return { {}, {} };
|
|
|
|
|
|
|
|
|
|
pt_entries entries;
|
|
|
|
|
if ((use_hyperspace ? hyperspace_entries(entries, addr) : (bool)virt_to_phys(entries, addr)))
|
|
|
|
|
return { entries.pt.first, entries.pt.second };
|
|
|
|
|
return {};
|
|
|
|
|
|
|
|
|
|
return { {}, {} };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mem_ctx::set_pte(void* addr, const ::pte& pte, bool use_hyperspace)
|
|
|
|
@ -223,7 +224,7 @@ namespace nasa
|
|
|
|
|
write_phys(addr, pte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<ppde, pde> mem_ctx::get_pde(void* addr, bool use_hyperspace)
|
|
|
|
|
auto mem_ctx::get_pde(void* addr, bool use_hyperspace) -> std::pair<ppde, pde>
|
|
|
|
|
{
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return {};
|
|
|
|
@ -236,7 +237,7 @@ namespace nasa
|
|
|
|
|
|
|
|
|
|
void mem_ctx::set_pde(void* addr, const ::pde& pde, bool use_hyperspace)
|
|
|
|
|
{
|
|
|
|
|
if (!this->dirbase || !addr)
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (use_hyperspace)
|
|
|
|
@ -245,7 +246,7 @@ namespace nasa
|
|
|
|
|
write_phys(addr, pde);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<ppdpte, pdpte> mem_ctx::get_pdpte(void* addr, bool use_hyperspace)
|
|
|
|
|
auto mem_ctx::get_pdpte(void* addr, bool use_hyperspace) -> std::pair<ppdpte, pdpte>
|
|
|
|
|
{
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return {};
|
|
|
|
@ -258,7 +259,7 @@ namespace nasa
|
|
|
|
|
|
|
|
|
|
void mem_ctx::set_pdpte(void* addr, const ::pdpte& pdpte, bool use_hyperspace)
|
|
|
|
|
{
|
|
|
|
|
if (!this->dirbase || !addr)
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (use_hyperspace)
|
|
|
|
@ -267,9 +268,9 @@ namespace nasa
|
|
|
|
|
write_phys(addr, pdpte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<ppml4e, pml4e> mem_ctx::get_pml4e(void* addr, bool use_hyperspace)
|
|
|
|
|
auto mem_ctx::get_pml4e(void* addr, bool use_hyperspace) -> std::pair<ppml4e, pml4e>
|
|
|
|
|
{
|
|
|
|
|
if (!this->dirbase || !addr)
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return {};
|
|
|
|
|
|
|
|
|
|
pt_entries entries;
|
|
|
|
@ -280,7 +281,7 @@ namespace nasa
|
|
|
|
|
|
|
|
|
|
void mem_ctx::set_pml4e(void* addr, const ::pml4e& pml4e, bool use_hyperspace)
|
|
|
|
|
{
|
|
|
|
|
if (!this->dirbase || !addr)
|
|
|
|
|
if (!dirbase || !addr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (use_hyperspace)
|
|
|
|
@ -289,7 +290,7 @@ namespace nasa
|
|
|
|
|
write_phys(addr, pml4e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<void*, void*> mem_ctx::read_virtual(void* buffer, void* addr, std::size_t size)
|
|
|
|
|
auto mem_ctx::read_virtual(void* buffer, void* addr, std::size_t size) -> std::pair<void*, void*>
|
|
|
|
|
{
|
|
|
|
|
if (!buffer || !addr || !size || !dirbase)
|
|
|
|
|
return {};
|
|
|
|
@ -331,7 +332,7 @@ namespace nasa
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<void*, void*> mem_ctx::write_virtual(void* buffer, void* addr, std::size_t size)
|
|
|
|
|
auto mem_ctx::write_virtual(void* buffer, void* addr, std::size_t size) -> std::pair<void*, void*>
|
|
|
|
|
{
|
|
|
|
|
if (!buffer || !addr || !size || !dirbase)
|
|
|
|
|
return {};
|
|
|
|
@ -403,7 +404,7 @@ namespace nasa
|
|
|
|
|
|
|
|
|
|
void* mem_ctx::virt_to_phys(pt_entries& entries, void* addr)
|
|
|
|
|
{
|
|
|
|
|
if (!addr || !this->dirbase)
|
|
|
|
|
if (!addr || !dirbase)
|
|
|
|
|
return {};
|
|
|
|
|
|
|
|
|
|
const virt_addr_t virt_addr{ addr };
|
|
|
|
|