diff --git a/xtoskrnl/CMakeLists.txt b/xtoskrnl/CMakeLists.txt index d6a2f57..80a9d05 100644 --- a/xtoskrnl/CMakeLists.txt +++ b/xtoskrnl/CMakeLists.txt @@ -62,6 +62,7 @@ list(APPEND XTOSKRNL_SOURCE ${XTOSKRNL_SOURCE_DIR}/mm/pages.c ${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/init.c ${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pages.c + ${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pmap.c ${XTOSKRNL_SOURCE_DIR}/po/idle.c ${XTOSKRNL_SOURCE_DIR}/rtl/atomic.c ${XTOSKRNL_SOURCE_DIR}/rtl/bitmap.c diff --git a/xtoskrnl/includes/amd64/mmi.h b/xtoskrnl/includes/amd64/mmi.h index 9d9ab6a..d5f91e8 100644 --- a/xtoskrnl/includes/amd64/mmi.h +++ b/xtoskrnl/includes/amd64/mmi.h @@ -13,11 +13,19 @@ /* AMD64 Memory Manager routines forward references */ +XTAPI +VOID +MmInitializePageMapSupport(VOID); + XTFASTCALL VOID MmZeroPages(IN PVOID Address, IN ULONG Size); +XTAPI +BOOLEAN +MmpGetExtendedPhysicalAddressingStatus(VOID); + XTAPI PMMPTE MmpGetPdeAddress(PVOID Address); @@ -38,8 +46,4 @@ XTAPI VOID MmpInitializeArchitecture(VOID); -XTAPI -BOOLEAN -MmpMemoryExtensionEnabled(VOID); - #endif /* __XTOSKRNL_AMD64_MMI_H */ diff --git a/xtoskrnl/includes/i686/mmi.h b/xtoskrnl/includes/i686/mmi.h index 31c0c10..218361b 100644 --- a/xtoskrnl/includes/i686/mmi.h +++ b/xtoskrnl/includes/i686/mmi.h @@ -13,15 +13,27 @@ /* i686 Memory Manager routines forward references */ +XTAPI +VOID +MmInitializePageMapSupport(VOID); + XTFASTCALL VOID MmZeroPages(IN PVOID Address, IN ULONG Size); XTAPI -PMMPTE +BOOLEAN +MmpGetExtendedPhysicalAddressingStatus(VOID); + +XTAPI +PMMPDE MmpGetPdeAddress(PVOID Address); +XTAPI +PMMPPE +MmpGetPpeAddress(PVOID Address); + XTAPI PMMPTE MmpGetPteAddress(PVOID Address); @@ -30,8 +42,4 @@ XTAPI VOID MmpInitializeArchitecture(VOID); -XTAPI -BOOLEAN -MmpMemoryExtensionEnabled(VOID); - #endif /* __XTOSKRNL_I686_MMI_H */ diff --git a/xtoskrnl/ke/amd64/krnlinit.c b/xtoskrnl/ke/amd64/krnlinit.c index 986a403..610e4ef 100644 --- a/xtoskrnl/ke/amd64/krnlinit.c +++ b/xtoskrnl/ke/amd64/krnlinit.c @@ -52,6 +52,9 @@ KepInitializeMachine(VOID) /* Initialize processor */ HlInitializeProcessor(); + + /* Initialize page map support */ + MmInitializePageMapSupport(); } /** diff --git a/xtoskrnl/ke/i686/krnlinit.c b/xtoskrnl/ke/i686/krnlinit.c index a671565..6d0d725 100644 --- a/xtoskrnl/ke/i686/krnlinit.c +++ b/xtoskrnl/ke/i686/krnlinit.c @@ -52,6 +52,9 @@ KepInitializeMachine(VOID) /* Initialize processor */ HlInitializeProcessor(); + + /* Initialize page map support */ + MmInitializePageMapSupport(); } /** diff --git a/xtoskrnl/mm/amd64/init.c b/xtoskrnl/mm/amd64/init.c index f746c4d..88e27d7 100644 --- a/xtoskrnl/mm/amd64/init.c +++ b/xtoskrnl/mm/amd64/init.c @@ -9,6 +9,20 @@ #include +/** + * Detects if eXtended Physical Addressing (XPA) is enabled and initializes page map support. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +MmInitializePageMapSupport(VOID) +{ + UNIMPLEMENTED; +} + /** * Gets the address of the PDE (Page Directory Entry), that maps given address. * @@ -102,18 +116,3 @@ 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; -} diff --git a/xtoskrnl/mm/amd64/pmap.c b/xtoskrnl/mm/amd64/pmap.c new file mode 100644 index 0000000..c1149dd --- /dev/null +++ b/xtoskrnl/mm/amd64/pmap.c @@ -0,0 +1,25 @@ +/** + * PROJECT: ExectOS + * COPYRIGHT: See COPYING.md in the top level directory + * FILE: xtoskrnl/mm/amd64/pmap.c + * DESCRIPTION: Low-level support for AMD64 page map manipulation + * DEVELOPERS: Aiken Harris + */ + +#include + + +/** + * Checks if eXtended Physical Addressing (XPA) is enabled. + * + * @return This routine returns TRUE if LA57 is enabled, or FALSE otherwise. + * + * @since XT 1.0 + */ +XTAPI +BOOLEAN +MmpGetExtendedPhysicalAddressingStatus(VOID) +{ + /* Check if LA57 is enabled */ + return ((ArReadControlRegister(4) & CR4_LA57) != 0) ? TRUE : FALSE; +} diff --git a/xtoskrnl/mm/i686/init.c b/xtoskrnl/mm/i686/init.c index aed604b..fe4887e 100644 --- a/xtoskrnl/mm/i686/init.c +++ b/xtoskrnl/mm/i686/init.c @@ -9,6 +9,20 @@ #include +/** + * Detects if eXtended Physical Addressing (XPA) is enabled and initializes page map support. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +MmInitializePageMapSupport(VOID) +{ + UNIMPLEMENTED; +} + /** * Gets the address of the PDE (Page Directory Entry), that maps given address. * @@ -64,18 +78,3 @@ 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; -} diff --git a/xtoskrnl/mm/i686/pmap.c b/xtoskrnl/mm/i686/pmap.c new file mode 100644 index 0000000..b7e759f --- /dev/null +++ b/xtoskrnl/mm/i686/pmap.c @@ -0,0 +1,25 @@ +/** + * PROJECT: ExectOS + * COPYRIGHT: See COPYING.md in the top level directory + * FILE: xtoskrnl/mm/i686/pmap.c + * DESCRIPTION: Low-level support for i686 page map manipulation + * DEVELOPERS: Aiken Harris + */ + +#include + + +/** + * Checks if eXtended Physical Addressing (XPA) is enabled. + * + * @return This routine returns TRUE if PAE is enabled, or FALSE otherwise. + * + * @since XT 1.0 + */ +XTAPI +BOOLEAN +MmpGetExtendedPhysicalAddressingStatus(VOID) +{ + /* Check if PAE is enabled */ + return ((ArReadControlRegister(4) & CR4_PAE) != 0) ? TRUE : FALSE; +}