Clarify page table entry offset semantics
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 26s
Builds / ExectOS (amd64, debug) (push) Successful in 27s
Builds / ExectOS (i686, debug) (push) Successful in 28s
Builds / ExectOS (i686, release) (push) Successful in 28s

This commit is contained in:
2025-12-18 22:38:59 +01:00
parent b183d52806
commit 570301bb35
4 changed files with 38 additions and 37 deletions

View File

@@ -29,23 +29,23 @@ namespace MM
XTAPI PMMPTE GetNextPte(IN PMMPTE Pte); XTAPI PMMPTE GetNextPte(IN PMMPTE Pte);
XTAPI BOOLEAN GetOneEntry(IN PMMPTE Pte); XTAPI BOOLEAN GetOneEntry(IN PMMPTE Pte);
XTAPI PMMP5E GetP5eAddress(IN PVOID Address); XTAPI PMMP5E GetP5eAddress(IN PVOID Address);
XTAPI ULONG GetP5eIndex(IN PVOID Address); XTAPI ULONG GetP5eOffset(IN PVOID Address);
XTAPI PVOID GetP5eVirtualAddress(IN PMMP5E P5ePointer); XTAPI PVOID GetP5eVirtualAddress(IN PMMP5E P5ePointer);
XTAPI PFN_NUMBER GetPageFrameNumber(IN PMMPTE Pte); XTAPI PFN_NUMBER GetPageFrameNumber(IN PMMPTE Pte);
XTAPI PMMPDE GetPdeAddress(IN PVOID Address); XTAPI PMMPDE GetPdeAddress(IN PVOID Address);
XTAPI ULONG GetPdeIndex(IN PVOID Address); XTAPI ULONG GetPdeOffset(IN PVOID Address);
VIRTUAL XTAPI PVOID GetPdeVirtualAddress(IN PMMPDE PdePointer) = 0; VIRTUAL XTAPI PVOID GetPdeVirtualAddress(IN PMMPDE PdePointer) = 0;
XTAPI PMMPPE GetPpeAddress(IN PVOID Address); XTAPI PMMPPE GetPpeAddress(IN PVOID Address);
XTAPI ULONG GetPpeIndex(IN PVOID Address); XTAPI ULONG GetPpeOffset(IN PVOID Address);
VIRTUAL XTAPI PVOID GetPpeVirtualAddress(IN PMMPPE PpePointer) = 0; VIRTUAL XTAPI PVOID GetPpeVirtualAddress(IN PMMPPE PpePointer) = 0;
XTAPI PMMPTE GetPteAddress(IN PVOID Address); XTAPI PMMPTE GetPteAddress(IN PVOID Address);
XTAPI LONG GetPteDistance(PMMPTE EndPte, XTAPI LONG GetPteDistance(PMMPTE EndPte,
PMMPTE StartPte); PMMPTE StartPte);
XTAPI ULONG GetPteIndex(IN PVOID Address); XTAPI ULONG GetPteOffset(IN PVOID Address);
XTAPI ULONG GetPteSize(VOID); XTAPI ULONG GetPteSize(VOID);
VIRTUAL XTAPI PVOID GetPteVirtualAddress(IN PMMPTE PtePointer) = 0; VIRTUAL XTAPI PVOID GetPteVirtualAddress(IN PMMPTE PtePointer) = 0;
XTAPI PMMPXE GetPxeAddress(IN PVOID Address); XTAPI PMMPXE GetPxeAddress(IN PVOID Address);
XTAPI ULONG GetPxeIndex(IN PVOID Address); XTAPI ULONG GetPxeOffset(IN PVOID Address);
VIRTUAL XTAPI PVOID GetPxeVirtualAddress(IN PMMPXE PxePointer) = 0; VIRTUAL XTAPI PVOID GetPxeVirtualAddress(IN PMMPXE PxePointer) = 0;
XTAPI BOOLEAN GetXpaStatus(); XTAPI BOOLEAN GetXpaStatus();
VIRTUAL XTAPI VOID InitializePageMapInfo(VOID) = 0; VIRTUAL XTAPI VOID InitializePageMapInfo(VOID) = 0;

View File

@@ -30,13 +30,13 @@ namespace MM
VIRTUAL XTAPI BOOLEAN GetOneEntry(IN PMMPTE Pte) = 0; VIRTUAL XTAPI BOOLEAN GetOneEntry(IN PMMPTE Pte) = 0;
VIRTUAL XTAPI PFN_NUMBER GetPageFrameNumber(IN PMMPTE Pte) = 0; VIRTUAL XTAPI PFN_NUMBER GetPageFrameNumber(IN PMMPTE Pte) = 0;
XTAPI PMMPDE GetPdeAddress(IN PVOID Address); XTAPI PMMPDE GetPdeAddress(IN PVOID Address);
XTAPI ULONG GetPdeIndex(IN PVOID Address); XTAPI ULONG GetPdeOffset(IN PVOID Address);
VIRTUAL XTAPI PVOID GetPdeVirtualAddress(IN PMMPDE PdePointer) = 0; VIRTUAL XTAPI PVOID GetPdeVirtualAddress(IN PMMPDE PdePointer) = 0;
XTAPI PMMPPE GetPpeAddress(IN PVOID Address); XTAPI PMMPPE GetPpeAddress(IN PVOID Address);
XTAPI ULONG GetPpeIndex(IN PVOID Address); XTAPI ULONG GetPpeOffset(IN PVOID Address);
XTAPI PVOID GetPpeVirtualAddress(IN PMMPPE PpePointer); XTAPI PVOID GetPpeVirtualAddress(IN PMMPPE PpePointer);
XTAPI PMMPTE GetPteAddress(IN PVOID Address); XTAPI PMMPTE GetPteAddress(IN PVOID Address);
XTAPI ULONG GetPteIndex(IN PVOID Address); XTAPI ULONG GetPteOffset(IN PVOID Address);
VIRTUAL XTAPI LONG GetPteDistance(PMMPTE EndPte, VIRTUAL XTAPI LONG GetPteDistance(PMMPTE EndPte,
PMMPTE StartPte) = 0; PMMPTE StartPte) = 0;
VIRTUAL XTAPI ULONG GetPteSize(VOID) = 0; VIRTUAL XTAPI ULONG GetPteSize(VOID) = 0;

View File

@@ -140,19 +140,20 @@ MM::PageMap::GetP5eAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the P5E (Page Map Level 5 Entry), that maps given address. * Gets the Offset of the P5E (Page Map Level 5 Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding P5E. * Specifies the virtual address for which to retrieve the corresponding P5E.
* *
* @return This routine returns the index of the P5E, or NULLPTR if LA57 is not enabled. * @return This routine returns the Offset of the P5E, or NULLPTR if LA57 is not enabled.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetP5eIndex(IN PVOID Address) MM::PageMap::GetP5eOffset(IN PVOID Address)
{ {
/* Return P5E Offset */
return (((((ULONGLONG)Address) >> MM_P5I_SHIFT) & 0x1FF) * PageMapInfo.Xpa); return (((((ULONGLONG)Address) >> MM_P5I_SHIFT) & 0x1FF) * PageMapInfo.Xpa);
} }
@@ -212,20 +213,20 @@ MM::PageMap::GetPdeAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PDE (Page Directory Entry), that maps given address. * Gets the Offset of the PDE (Page Directory Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PDE. * Specifies the virtual address for which to retrieve the corresponding PDE.
* *
* @return This routine returns the index of the PDE. * @return This routine returns the Offset of the PDE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPdeIndex(IN PVOID Address) MM::PageMap::GetPdeOffset(IN PVOID Address)
{ {
/* Return PDE index */ /* Return PDE Offset */
return ((((ULONGLONG)Address) >> MM_PDI_SHIFT) & 0x1FF); return ((((ULONGLONG)Address) >> MM_PDI_SHIFT) & 0x1FF);
} }
@@ -251,20 +252,20 @@ MM::PageMap::GetPpeAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PPE (Page Directory Pointer Table Entry), that maps given address. * Gets the Offset of the PPE (Page Directory Pointer Table Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PPE. * Specifies the virtual address for which to retrieve the corresponding PPE.
* *
* @return This routine returns the index of the PPE. * @return This routine returns the Offset of the PPE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPpeIndex(IN PVOID Address) MM::PageMap::GetPpeOffset(IN PVOID Address)
{ {
/* Return PPE index */ /* Return PPE Offset */
return ((((ULONGLONG)Address) >> MM_PPI_SHIFT) & 0x1FF); return ((((ULONGLONG)Address) >> MM_PPI_SHIFT) & 0x1FF);
} }
@@ -312,20 +313,20 @@ MM::PageMap::GetPteDistance(PMMPTE EndPte,
} }
/** /**
* Gets the index of the PTE (Page Table Entry), that maps given address. * Gets the Offset of the PTE (Page Table Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PTE. * Specifies the virtual address for which to retrieve the corresponding PTE.
* *
* @return This routine returns the index of the PTE. * @return This routine returns the Offset of the PTE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPteIndex(IN PVOID Address) MM::PageMap::GetPteOffset(IN PVOID Address)
{ {
/* Return PTE index */ /* Return PTE Offset */
return ((((ULONGLONG)Address) >> MM_PTI_SHIFT) & 0x1FF); return ((((ULONGLONG)Address) >> MM_PTI_SHIFT) & 0x1FF);
} }
@@ -366,20 +367,20 @@ MM::PageMap::GetPxeAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PXE (Extended Page Entry), that maps given address. * Gets the Offset of the PXE (Extended Page Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PXE. * Specifies the virtual address for which to retrieve the corresponding PXE.
* *
* @return This routine returns the index of the PXE. * @return This routine returns the Offset of the PXE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPxeIndex(IN PVOID Address) MM::PageMap::GetPxeOffset(IN PVOID Address)
{ {
/* Return PXE index */ /* Return PXE Offset */
return ((((ULONGLONG)Address) >> MM_PXI_SHIFT) & 0x1FF); return ((((ULONGLONG)Address) >> MM_PXI_SHIFT) & 0x1FF);
} }

View File

@@ -64,20 +64,20 @@ MM::PageMap::GetPdeAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PDE (Page Directory Entry), that maps given address. * Gets the Offset of the PDE (Page Directory Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PDE. * Specifies the virtual address for which to retrieve the corresponding PDE.
* *
* @return This routine returns the index of the PDE. * @return This routine returns the Offset of the PDE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPdeIndex(IN PVOID Address) MM::PageMap::GetPdeOffset(IN PVOID Address)
{ {
/* Return PDE index */ /* Return PDE Offset */
return ((((ULONG_PTR)(Address)) >> PageMapInfo.PdiShift) & (PageMapInfo.Xpa ? 0x1FF : 0x3FF)); return ((((ULONG_PTR)(Address)) >> PageMapInfo.PdiShift) & (PageMapInfo.Xpa ? 0x1FF : 0x3FF));
} }
@@ -101,7 +101,7 @@ MM::PageMap::GetPpeAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PPE (Page Directory Pointer Table Entry), that maps given address. * Gets the offset of the PPE (Page Directory Pointer Table Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PPE. * Specifies the virtual address for which to retrieve the corresponding PPE.
@@ -112,7 +112,7 @@ MM::PageMap::GetPpeAddress(IN PVOID Address)
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPpeIndex(IN PVOID Address) MM::PageMap::GetPpeOffset(IN PVOID Address)
{ {
/* Return zero */ /* Return zero */
return 0; return 0;
@@ -158,20 +158,20 @@ MM::PageMap::GetPteAddress(IN PVOID Address)
} }
/** /**
* Gets the index of the PTE (Page Table Entry), that maps given address. * Gets the Offset of the PTE (Page Table Entry), that maps given address.
* *
* @param Address * @param Address
* Specifies the virtual address for which to retrieve the corresponding PTE. * Specifies the virtual address for which to retrieve the corresponding PTE.
* *
* @return This routine returns the index of the PTE. * @return This routine returns the Offset of the PTE.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTAPI XTAPI
ULONG ULONG
MM::PageMap::GetPteIndex(IN PVOID Address) MM::PageMap::GetPteOffset(IN PVOID Address)
{ {
/* Return PTE index */ /* Return PTE Offset */
return ((((ULONG_PTR)(Address)) >> MM_PTI_SHIFT) & (PageMapInfo.Xpa ? 0x1FF : 0x3FF)); return ((((ULONG_PTR)(Address)) >> MM_PTI_SHIFT) & (PageMapInfo.Xpa ? 0x1FF : 0x3FF));
} }