Set PTE frame for non-paged pool allocations
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 24s
Builds / ExectOS (i686, release) (push) Successful in 36s
Builds / ExectOS (i686, debug) (push) Successful in 29s
Builds / ExectOS (amd64, release) (push) Successful in 39s

This commit is contained in:
2026-03-24 20:03:23 +01:00
parent 9a34a5f735
commit 92986e1386
2 changed files with 15 additions and 1 deletions

View File

@@ -41,6 +41,19 @@
/* Number of reserved zeroed PTEs */ /* Number of reserved zeroed PTEs */
#define MM_RESERVED_ZERO_PTES 32 #define MM_RESERVED_ZERO_PTES 32
/* Memory Manager Protection Bits */
#define MM_ZERO_ACCESS 0
#define MM_READONLY 1
#define MM_EXECUTE 2
#define MM_EXECUTE_READ 3
#define MM_READWRITE 4
#define MM_WRITECOPY 5
#define MM_EXECUTE_READWRITE 6
#define MM_EXECUTE_WRITECOPY 7
#define MM_PROTECT_ACCESS 7
/* Protection field shift */
#define MM_PROTECT_FIELD_SHIFT 5
/* Memory manager page lists */ /* Memory manager page lists */
typedef enum _MMPAGELISTS typedef enum _MMPAGELISTS

View File

@@ -151,11 +151,12 @@ MM::Allocator::AllocateNonPagedPoolPages(IN PFN_COUNT Pages,
/* Initialize the PFN entry for the allocated physical page */ /* Initialize the PFN entry for the allocated physical page */
Pfn = MM::Pfn::GetPfnEntry(PageFrameNumber); Pfn = MM::Pfn::GetPfnEntry(PageFrameNumber);
MM::Paging::SetPte(&Pfn->OriginalPte, 0, MM_READWRITE << MM_PROTECT_FIELD_SHIFT);
Pfn->PteAddress = CurrentPte; Pfn->PteAddress = CurrentPte;
Pfn->u2.ShareCount = 1; Pfn->u2.ShareCount = 1;
Pfn->u3.e1.PageLocation = ActiveAndValid; Pfn->u3.e1.PageLocation = ActiveAndValid;
Pfn->u3.e2.ReferenceCount = 1; Pfn->u3.e2.ReferenceCount = 1;
Pfn->u4.VerifierAllocation = 0; Pfn->u4.PteFrame = MM::Paging::GetPageFrameNumber(MM::Paging::GetPteAddress(CurrentPte));
/* Build a valid PTE pointing to the allocated page frame */ /* Build a valid PTE pointing to the allocated page frame */
MM::Paging::SetPte(ValidPte, PageFrameNumber, 0); MM::Paging::SetPte(ValidPte, PageFrameNumber, 0);