forked from xt-sys/exectos
Implement MmpGetPdeAddress() and MmpGetPteAddress() routines for i686 architecture as well as MmpMemoryExtensionEnabled() for checking PAE/LA57 support
This commit is contained in:
@@ -102,3 +102,18 @@ MmpInitializeArchitecture(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if LA57 (PML5) is enabled.
|
||||
*
|
||||
* @return This routine returns TRUE if LA57 is enabled, or FALSE otherwise.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
BOOLEAN
|
||||
MmpMemoryExtensionEnabled(VOID)
|
||||
{
|
||||
/* Check if LA57 (PML5) is enabled */
|
||||
return ((ArReadControlRegister(4) & CR4_LA57) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
@@ -36,5 +36,8 @@ LOADER_MEMORY_MAPPING MmpHalAllocationDescriptors[MM_HAL_ALLOCATION_DESCRIPTORS]
|
||||
/* Live address of kernel HAL heap */
|
||||
PVOID MmpHalHeapStart = MM_HAL_HEAP_START_ADDRESS;
|
||||
|
||||
/* Architecture-specific memory extension */
|
||||
BOOLEAN MmpMemoryExtension;
|
||||
|
||||
/* Number of used HAL allocation descriptors */
|
||||
ULONG MmpUsedHalAllocationDescriptors = 0;
|
||||
|
@@ -9,6 +9,67 @@
|
||||
#include <xtos.h>
|
||||
|
||||
|
||||
/**
|
||||
* Gets the address of the PDE (Page Directory Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the address to find the PDE for.
|
||||
*
|
||||
* @return This routine returns the address of the PDE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPdeAddress(PVOID Address)
|
||||
{
|
||||
ULONG Offset, PdeBase, PdiShift, PteShift;
|
||||
|
||||
/* Get PDI and PTE shifts based on memory extension flag */
|
||||
if(MmpMemoryExtension)
|
||||
{
|
||||
/* Get bit shifts for PAE system */
|
||||
PdeBase = MM_PDE_PAE_BASE;
|
||||
PdiShift = MM_PDI_PAE_SHIFT;
|
||||
PteShift = MM_PTE_PAE_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get bit shifts for non-PAE system */
|
||||
PdeBase = MM_PDE_BASE;
|
||||
PdiShift = MM_PDI_SHIFT;
|
||||
PteShift = MM_PTE_SHIFT;
|
||||
}
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> PdiShift) << PteShift);
|
||||
return (PMMPTE)(PdeBase + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PTE (Page Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the address to find the PTE for.
|
||||
*
|
||||
* @return This routine returns the address of the PTE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPteAddress(PVOID Address)
|
||||
{
|
||||
ULONG Offset, PteShift;
|
||||
|
||||
/* Get PTE shift based on memory extension flag */
|
||||
PteShift = MmpMemoryExtension ? MM_PTE_PAE_SHIFT : MM_PTE_SHIFT;
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> MM_PTI_SHIFT) << PteShift);
|
||||
return (PMMPTE)(MM_PTE_BASE + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs architecture specific initialization of the XTOS Memory Manager.
|
||||
*
|
||||
@@ -22,3 +83,18 @@ MmpInitializeArchitecture(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if PAE (Physical Address Extension) is enabled.
|
||||
*
|
||||
* @return This routine returns TRUE if PAE is enabled, or FALSE otherwise.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
BOOLEAN
|
||||
MmpMemoryExtensionEnabled(VOID)
|
||||
{
|
||||
/* Check if PAE is enabled */
|
||||
return ((ArReadControlRegister(4) & CR4_PAE) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
@@ -9,6 +9,21 @@
|
||||
#include <xtos.h>
|
||||
|
||||
|
||||
/**
|
||||
* Performs an early pre-initialization of hardware-related structures.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
VOID
|
||||
MmInitializeHardware(VOID)
|
||||
{
|
||||
/* Check for architecture-specific memory extensions enabled by the firmware or boot loader */
|
||||
MmpMemoryExtension = MmpMemoryExtensionEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an early initialization of the XTOS Memory Manager.
|
||||
*
|
||||
|
Reference in New Issue
Block a user