From 585afda693ad21d91c0bdad4d09462ce266de148 Mon Sep 17 00:00:00 2001 From: xerox Date: Wed, 4 Nov 2020 16:04:50 -0800 Subject: [PATCH] was getting an empty pml4e in the wrong context, this is correct now --- nasa-tables/mem_ctx/mem_ctx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nasa-tables/mem_ctx/mem_ctx.cpp b/nasa-tables/mem_ctx/mem_ctx.cpp index 7cdb1cc..217e94a 100644 --- a/nasa-tables/mem_ctx/mem_ctx.cpp +++ b/nasa-tables/mem_ctx/mem_ctx.cpp @@ -8,11 +8,14 @@ namespace nasa dirbase(get_dirbase(v_ctx, pid)), pid(pid) { - // find an empty pml4e... + // find an empty pml4e inside of current processes pml4... + const auto current_pml4 = + v_ctx.get_virtual(reinterpret_cast( + get_dirbase(v_ctx, GetCurrentProcessId()))); + for (auto idx = 100u; idx > 0u; --idx) - if (!v_ctx.rkm(v_ctx.get_virtual(( - reinterpret_cast(get_dirbase()) + idx))).value) - this->pml4e_index = idx; + if (!v_ctx.rkm(current_pml4 + (idx * sizeof pml4e)).value) + this->pml4e_index = idx; // allocate a pdpt this->new_pdpt.second =