Relocate page mapping helpers and add PML5 support
This commit is contained in:
parent
de2973ac42
commit
0ed59f223c
@ -67,6 +67,7 @@ typedef union _APIC_BASE_REGISTER APIC_BASE_REGISTER, *PAPIC_BASE_REGISTER;
|
||||
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER, *PAPIC_COMMAND_REGISTER;
|
||||
typedef union _APIC_LVT_REGISTER APIC_LVT_REGISTER, *PAPIC_LVT_REGISTER;
|
||||
typedef union _APIC_SPURIOUS_REGISTER APIC_SPURIOUS_REGISTER, *PAPIC_SPURIOUS_REGISTER;
|
||||
typedef union _MMPTE MMP5E, *PMMP5E;
|
||||
typedef union _MMPTE MMPDE, *PMMPDE;
|
||||
typedef union _MMPTE MMPPE, *PMMPPE;
|
||||
typedef union _MMPTE MMPTE, *PMMPTE;
|
||||
|
@ -27,11 +27,15 @@ BOOLEAN
|
||||
MmpGetExtendedPhysicalAddressingStatus(VOID);
|
||||
|
||||
XTAPI
|
||||
PMMPTE
|
||||
PMMP5E
|
||||
MmpGetP5eAddress(PVOID Address);
|
||||
|
||||
XTAPI
|
||||
PMMPDE
|
||||
MmpGetPdeAddress(PVOID Address);
|
||||
|
||||
XTAPI
|
||||
PMMPTE
|
||||
PMMPPE
|
||||
MmpGetPpeAddress(PVOID Address);
|
||||
|
||||
XTAPI
|
||||
@ -39,7 +43,7 @@ PMMPTE
|
||||
MmpGetPteAddress(PVOID Address);
|
||||
|
||||
XTAPI
|
||||
PMMPTE
|
||||
PMMPXE
|
||||
MmpGetPxeAddress(PVOID Address);
|
||||
|
||||
XTAPI
|
||||
|
@ -47,86 +47,6 @@ MmInitializePageMapSupport(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = ((((ULONGLONG)Address & (((ULONGLONG)1 << 48) - 1)) >> MM_PDI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MM_PDE_BASE + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PPE (Page Directory Pointer Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the address to find the PPE for.
|
||||
*
|
||||
* @return This routine returns the address of the PPE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPpeAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = ((((ULONGLONG)Address & (((ULONGLONG)1 << 48) - 1)) >> MM_PPI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MM_PPE_BASE + 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)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = ((((ULONGLONG)Address & (((ULONGLONG)1 << 48) - 1)) >> MM_PTI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MM_PTE_BASE + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PXE (Extended Page Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the address to find the PXE for.
|
||||
*
|
||||
* @return This routine returns the address of the PXE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPxeAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_PXI_SHIFT) & (MM_PXE_PER_PAGE - 1));
|
||||
return (PMMPTE)(MM_PXE_BASE + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs architecture specific initialization of the XTOS Memory Manager.
|
||||
*
|
||||
|
@ -23,3 +23,103 @@ MmpGetExtendedPhysicalAddressingStatus(VOID)
|
||||
/* Check if LA57 is enabled */
|
||||
return ((ArReadControlRegister(4) & CR4_LA57) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the P5E (Page Map Level 5 Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding P5E.
|
||||
*
|
||||
* @return This routine returns the address of the P5E, or NULL if LA57 is not enabled.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMP5E
|
||||
MmpGetP5eAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_P5I_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMP5E)((MmpPageMapInfo.P5eBase + Offset) * MmpPageMapInfo.Xpa);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PDE (Page Directory Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PDE.
|
||||
*
|
||||
* @return This routine returns the address of the PDE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPDE
|
||||
MmpGetPdeAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_PDI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPDE)(MmpPageMapInfo.PdeBase + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PPE (Page Directory Pointer Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PPE.
|
||||
*
|
||||
* @return This routine returns the address of the PPE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPPE
|
||||
MmpGetPpeAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_PPI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPPE)(MmpPageMapInfo.PpeBase + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PTE (Page Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PTE.
|
||||
*
|
||||
* @return This routine returns the address of the PTE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPteAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_PTI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MmpPageMapInfo.PteBase + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PXE (Extended Page Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PXE.
|
||||
*
|
||||
* @return This routine returns the address of the PXE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPXE
|
||||
MmpGetPxeAddress(PVOID Address)
|
||||
{
|
||||
ULONGLONG Offset;
|
||||
|
||||
Offset = (((ULONGLONG)Address >> MM_PXI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPXE)(MmpPageMapInfo.PxeBase + Offset);
|
||||
}
|
||||
|
@ -49,48 +49,6 @@ MmInitializePageMapSupport(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> MM_PDI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MM_PDE_BASE + 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;
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> MM_PTI_SHIFT) << MM_PTE_SHIFT);
|
||||
return (PMMPTE)(MM_PTE_BASE + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs architecture specific initialization of the XTOS Memory Manager.
|
||||
*
|
||||
|
@ -23,3 +23,63 @@ MmpGetExtendedPhysicalAddressingStatus(VOID)
|
||||
/* Check if PAE is enabled */
|
||||
return ((ArReadControlRegister(4) & CR4_PAE) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PDE (Page Directory Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PDE.
|
||||
*
|
||||
* @return This routine returns the address of the PDE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPDE
|
||||
MmpGetPdeAddress(PVOID Address)
|
||||
{
|
||||
ULONG Offset;
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> MmpPageMapInfo.PdiShift) << MmpPageMapInfo.PteShift);
|
||||
return (PMMPTE)(MmpPageMapInfo.PdeBase + Offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PPE (Page Directory Pointer Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PDE.
|
||||
*
|
||||
* @return This routine returns the address of the PPE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPPE
|
||||
MmpGetPpeAddress(PVOID Address)
|
||||
{
|
||||
/* Return zero */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address of the PTE (Page Table Entry), that maps given address.
|
||||
*
|
||||
* @param Address
|
||||
* Specifies the virtual address for which to retrieve the corresponding PTE.
|
||||
*
|
||||
* @return This routine returns the address of the PTE.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
PMMPTE
|
||||
MmpGetPteAddress(PVOID Address)
|
||||
{
|
||||
ULONG Offset;
|
||||
|
||||
/* Calculate offset and return PTE address */
|
||||
Offset = ((((ULONG)(Address)) >> MM_PTI_SHIFT) << MmpPageMapInfo.PteShift);
|
||||
return (PMMPTE)(MM_PTE_BASE + Offset);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user