updated stuff i forgot what i added

master
_xeroxz 4 years ago
parent ac14fbce56
commit b2a6ab5148

@ -17,7 +17,7 @@ namespace nasa
map_into->set_page(map_into->dirbase));
// look for an empty pml4e...
for (auto idx = 0u; idx < 256; ++idx)
for (auto idx = 100u; idx < 255; ++idx)
{
if (!map_into_pml4[idx].value)
{
@ -38,6 +38,7 @@ namespace nasa
drv_pml4e.nx = false;
drv_pml4e.user_supervisor = false;
drv_pml4e.write = true;
// ensure we insert the pml4e...
while (!map_into->write_phys(
@ -68,7 +69,8 @@ namespace nasa
if (!process_handle)
return { {}, {} };
drv_image.fix_imports([&](const char* module_name, const char* export_name)
drv_image.fix_imports(
[&](const char* module_name, const char* export_name)
{
return reinterpret_cast<std::uintptr_t>(
util::get_kmodule_export(
@ -137,6 +139,7 @@ namespace nasa
{
pdpt_mapping[pdpt_idx].user_supervisor = false;
pdpt_mapping[pdpt_idx].nx = false;
pdpt_mapping[pdpt_idx].write = true;
auto pd_mapping = reinterpret_cast<ppde>(
map_from->set_page(reinterpret_cast<void*>(
@ -149,6 +152,7 @@ namespace nasa
{
pd_mapping[pd_idx].user_supervisor = false;
pd_mapping[pd_idx].nx = false;
pd_mapping[pd_idx].write = true;
auto pt_mapping = reinterpret_cast<ppte>(
map_from->set_page(reinterpret_cast<void*>(
@ -161,6 +165,7 @@ namespace nasa
{
pt_mapping[pt_idx].user_supervisor = false;
pt_mapping[pt_idx].nx = false;
pt_mapping[pt_idx].write = true;
}
}

@ -116,7 +116,7 @@ namespace nasa
pdpte new_pdpte = { NULL };
new_pdpte.present = true;
new_pdpte.rw = true;
new_pdpte.write = true;
new_pdpte.pfn = reinterpret_cast<std::uintptr_t>(new_pd.first) >> 12;
new_pdpte.user_supervisor = true;
@ -125,7 +125,7 @@ namespace nasa
pde new_pde = { NULL };
new_pde.present = true;
new_pde.rw = true;
new_pde.write = true;
new_pde.pfn = reinterpret_cast<std::uintptr_t>(new_pt.first) >> 12;
new_pde.user_supervisor = true;
@ -134,7 +134,7 @@ namespace nasa
pte new_pte = { NULL };
new_pte.present = true;
new_pte.rw = true;
new_pte.write = true;
new_pte.pfn = reinterpret_cast<std::uintptr_t>(addr) >> 12;
new_pte.user_supervisor = true;

@ -97,7 +97,7 @@ typedef union _pml4e
struct
{
std::uint64_t present : 1; // Must be 1, region invalid if 0.
std::uint64_t ReadWrite : 1; // If 0, writes not allowed.
std::uint64_t write : 1; // If 0, writes not allowed.
std::uint64_t user_supervisor : 1; // If 0, user-mode accesses not allowed.
std::uint64_t PageWriteThrough : 1; // Determines the memory type used to access PDPT.
std::uint64_t page_cache : 1; // Determines the memory type used to access PDPT.
@ -119,7 +119,7 @@ typedef union _pdpte
struct
{
std::uint64_t present : 1; // Must be 1, region invalid if 0.
std::uint64_t rw : 1; // If 0, writes not allowed.
std::uint64_t write : 1; // If 0, writes not allowed.
std::uint64_t user_supervisor : 1; // If 0, user-mode accesses not allowed.
std::uint64_t PageWriteThrough : 1; // Determines the memory type used to access PD.
std::uint64_t page_cache : 1; // Determines the memory type used to access PD.
@ -141,7 +141,7 @@ typedef union _pde
struct
{
std::uint64_t present : 1; // Must be 1, region invalid if 0.
std::uint64_t rw : 1; // If 0, writes not allowed.
std::uint64_t write : 1; // If 0, writes not allowed.
std::uint64_t user_supervisor : 1; // If 0, user-mode accesses not allowed.
std::uint64_t PageWriteThrough : 1; // Determines the memory type used to access PT.
std::uint64_t page_cache : 1; // Determines the memory type used to access PT.
@ -163,7 +163,7 @@ typedef union _pte
struct
{
std::uint64_t present : 1; // Must be 1, region invalid if 0.
std::uint64_t rw : 1; // If 0, writes not allowed.
std::uint64_t write : 1; // If 0, writes not allowed.
std::uint64_t user_supervisor : 1; // If 0, user-mode accesses not allowed.
std::uint64_t PageWriteThrough : 1; // Determines the memory type used to access the memory.
std::uint64_t page_cache : 1; // Determines the memory type used to access the memory.
@ -175,7 +175,7 @@ typedef union _pte
std::uint64_t pfn : 36; // The page frame number of the backing physical page.
std::uint64_t reserved : 4;
std::uint64_t Ignored3 : 7;
std::uint64_t ProtectionKey : 4; // If the PKE bit of CR4 is set, determines the protection key.
std::uint64_t pk : 4; // If the PKE bit of CR4 is set, determines the protection key.
std::uint64_t nx : 1; // If 1, instruction fetches not allowed.
};
} pte, * ppte;

Binary file not shown.
Loading…
Cancel
Save