Add virtual address validation and system PTE helpers
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 27s
Builds / ExectOS (amd64, debug) (push) Successful in 28s
Builds / ExectOS (i686, debug) (push) Successful in 29s
Builds / ExectOS (i686, release) (push) Successful in 26s

This commit is contained in:
2025-12-16 22:31:15 +01:00
parent 728241f998
commit cb4d113e31
4 changed files with 154 additions and 0 deletions

View File

@@ -8,3 +8,68 @@
#include <xtos.hh>
/**
* Checks if the virtual address is valid and mapped in the page tables.
*
* @param VirtualAddress
* The virtual address to check.
*
* @return This routine returns TRUE if the address is valid, or FALSE otherwise.
*
* @since XT 1.0
*/
XTAPI
BOOLEAN
MM::Pte::AddressValid(IN PVOID VirtualAddress)
{
/* Check XPA status */
if(MM::Paging::GetXpaStatus())
{
/* Check if the P5E is valid */
if(!MM::Paging::PteValid(MM::Paging::GetPpeAddress(VirtualAddress)))
{
/* Invalid PPE, return FALSE */
return FALSE;
}
}
/* Check if PDE and PTE are valid */
if(!MM::Paging::PteValid(MM::Paging::GetPdeAddress(VirtualAddress)) ||
!MM::Paging::PteValid(MM::Paging::GetPteAddress(VirtualAddress)))
{
/* Invalid PDE or PTE, return FALSE */
return FALSE;
}
/* Address is valid, return TRUE */
return TRUE;
}
/**
* Retrieves the base virtual address of the system PTEs.
*
* @return This routine returns a pointer to the first PTE in the system PTE space.
*
* @since XT 1.0
*/
XTAPI
PMMPTE
MM::Pte::GetSystemPteBaseAddress(VOID)
{
return MM::Paging::GetPteAddress(NULLPTR);
}
/**
* Performs the initial setup of the system's page table hierarchy.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Pte::InitializePageTable(VOID)
{
UNIMPLEMENTED;
}