Extend PTE helpers with raw read and write support

This commit is contained in:
2025-12-22 08:21:43 +01:00
parent 755a167f2c
commit e237a944cc
7 changed files with 174 additions and 1 deletions

View File

@@ -301,6 +301,23 @@ MM::PageMapBasic::GetPdeVirtualAddress(IN PMMPDE PdePointer)
return ((PVOID)((ULONG)(PdePointer) << 20));
}
/**
* Gets the entire contents of a PML2 Page Table Entry (PTE) as a single value.
*
* @param PtePointer
* Pointer to the Page Table Entry (PTE) to read.
*
* @return This routine returns the contents of the PTE as a single value.
*
* @since XT 1.0
*/
XTAPI
ULONG_PTR
MM::PageMapBasic::GetPte(IN PMMPTE PtePointer)
{
/* Return PTE value */
return PtePointer->Pml2.Long;
}
/**
* Calculates the distance between two PTE pointers.
*
@@ -472,6 +489,27 @@ MM::PageMapBasic::SetPte(IN PMMPTE PtePointer,
PtePointer->Pml2.Long |= AttributesMask;
}
/**
* Sets a PML2 page table entry (PTE) with the specified attributes.
*
* @param PtePointer
* Pointer to the page table entry (PTE) to set.
*
* @param Attributes
* Specifies the attributes to apply to the PTE.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::PageMapBasic::SetPte(IN PMMPTE PtePointer,
IN ULONG_PTR Attributes)
{
PtePointer->Pml2.Long = Attributes;
}
/**
* Sets caching attributes for a PML2 page table entry (PTE).
*
@@ -650,6 +688,24 @@ MM::PageMapXpa::GetPdeVirtualAddress(IN PMMPDE PdePointer)
return ((PVOID)((ULONG)(PdePointer) << 18));
}
/**
* Gets the entire contents of a PML3 Page Table Entry (PTE) as a single value.
*
* @param PtePointer
* Pointer to the Page Table Entry (PTE) to read.
*
* @return This routine returns the contents of the PTE as a single value.
*
* @since XT 1.0
*/
XTAPI
ULONG_PTR
MM::PageMapXpa::GetPte(IN PMMPTE PtePointer)
{
/* Return PTE value */
return PtePointer->Pml3.Long;
}
/**
* Calculates the distance between two PTE pointers.
*
@@ -820,6 +876,27 @@ MM::PageMapXpa::SetPte(IN PMMPTE PtePointer,
PtePointer->Pml3.Long |= AttributesMask;
}
/**
* Sets a PML3 page table entry (PTE) with the specified attributes.
*
* @param PtePointer
* Pointer to the page table entry (PTE) to set.
*
* @param Attributes
* Specifies the attributes to apply to the PTE.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::PageMapXpa::SetPte(IN PMMPTE PtePointer,
IN ULONG_PTR Attributes)
{
PtePointer->Pml3.Long = Attributes;
}
/**
* Sets caching attributes for a PML3 page table entry (PTE).
*