Refactor MMU for multi-paging support and add 5-Level paging #16
@ -10,8 +10,18 @@
|
|||||||
#define __XTDK_MMTYPES_H
|
#define __XTDK_MMTYPES_H
|
||||||
|
|
||||||
#include <xtbase.h>
|
#include <xtbase.h>
|
||||||
|
#include ARCH_HEADER(xtstruct.h)
|
||||||
|
|
||||||
|
|
||||||
|
/* Page map routines structure definition */
|
||||||
|
typedef CONST STRUCT _CMMPAGEMAP_ROUTINES
|
||||||
|
{
|
||||||
|
VOID (XTAPI *ClearPte)(PHARDWARE_PTE PtePointer);
|
||||||
|
BOOLEAN (XTAPI *PteValid)(PHARDWARE_PTE PtePointer);
|
||||||
|
VOID (XTAPI *SetPteCaching)(PHARDWARE_PTE PtePointer, BOOLEAN CacheDisable, BOOLEAN WriteThrough);
|
||||||
|
VOID (XTAPI *SetPte)(PHARDWARE_PTE PtePointer, PFN_NUMBER PageFrameNumber, BOOLEAN Writable);
|
||||||
|
} CMMPAGEMAP_ROUTINES, *PCMMPAGEMAP_ROUTINES;
|
||||||
|
|
||||||
/* Color tables structure definition */
|
/* Color tables structure definition */
|
||||||
typedef struct _MMCOLOR_TABLES
|
typedef struct _MMCOLOR_TABLES
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,7 @@ typedef struct _ANSI_STRING ANSI_STRING, *PANSI_STRING;
|
|||||||
typedef struct _ANSI_STRING32 ANSI_STRING32, *PANSI_STRING32;
|
typedef struct _ANSI_STRING32 ANSI_STRING32, *PANSI_STRING32;
|
||||||
typedef struct _ANSI_STRING64 ANSI_STRING64, *PANSI_STRING64;
|
typedef struct _ANSI_STRING64 ANSI_STRING64, *PANSI_STRING64;
|
||||||
typedef struct _CPPORT CPPORT, *PCPPORT;
|
typedef struct _CPPORT CPPORT, *PCPPORT;
|
||||||
|
typedef const struct _CMMPAGEMAP_ROUTINES CMMPAGEMAP_ROUTINES, *PCMMPAGEMAP_ROUTINES;
|
||||||
typedef struct _CSTRING CSTRING, *PCSTRING;
|
typedef struct _CSTRING CSTRING, *PCSTRING;
|
||||||
typedef struct _EFI_1394_DEVICE_PATH EFI_1394_DEVICE_PATH, *PEFI_1394_DEVICE_PATH;
|
typedef struct _EFI_1394_DEVICE_PATH EFI_1394_DEVICE_PATH, *PEFI_1394_DEVICE_PATH;
|
||||||
typedef struct _EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, *PEFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
|
typedef struct _EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, *PEFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
|
||||||
|
@ -60,6 +60,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/mm/init.c
|
${XTOSKRNL_SOURCE_DIR}/mm/init.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/kpools.c
|
${XTOSKRNL_SOURCE_DIR}/mm/kpools.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/pages.c
|
${XTOSKRNL_SOURCE_DIR}/mm/pages.c
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/globals.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/init.c
|
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/init.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pages.c
|
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pages.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pmap.c
|
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pmap.c
|
||||||
|
@ -30,4 +30,10 @@ EXTERN UCHAR ArKernelBootStack[KERNEL_STACK_SIZE];
|
|||||||
/* Kernel own fault stack */
|
/* Kernel own fault stack */
|
||||||
EXTERN UCHAR ArKernelFaultStack[KERNEL_STACK_SIZE];
|
EXTERN UCHAR ArKernelFaultStack[KERNEL_STACK_SIZE];
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 4-level paging (PML4) */
|
||||||
|
EXTERN CMMPAGEMAP_ROUTINES MmpPml4Routines;
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 5-level paging (PML5) */
|
||||||
|
EXTERN CMMPAGEMAP_ROUTINES MmpPml5Routines;
|
||||||
|
|
||||||
#endif /* __XTOSKRNL_AMD64_GLOBALS_H */
|
#endif /* __XTOSKRNL_AMD64_GLOBALS_H */
|
||||||
|
@ -87,6 +87,9 @@ EXTERN PVOID MmpHardwareHeapStart;
|
|||||||
/* Information about the current page map */
|
/* Information about the current page map */
|
||||||
EXTERN MMPAGEMAP_INFO MmpPageMapInfo;
|
EXTERN MMPAGEMAP_INFO MmpPageMapInfo;
|
||||||
|
|
||||||
|
/* Pointers to page map routines for the current paging mode */
|
||||||
|
EXTERN PCMMPAGEMAP_ROUTINES MmpPageMapRoutines;
|
||||||
|
|
||||||
/* Number of used hardware allocation descriptors */
|
/* Number of used hardware allocation descriptors */
|
||||||
EXTERN ULONG MmpUsedHardwareAllocationDescriptors;
|
EXTERN ULONG MmpUsedHardwareAllocationDescriptors;
|
||||||
|
|
||||||
|
@ -34,4 +34,10 @@ EXTERN UCHAR ArKernelBootStack[KERNEL_STACK_SIZE];
|
|||||||
/* Kernel own fault stack */
|
/* Kernel own fault stack */
|
||||||
EXTERN UCHAR ArKernelFaultStack[KERNEL_STACK_SIZE];
|
EXTERN UCHAR ArKernelFaultStack[KERNEL_STACK_SIZE];
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 2-level paging (PML2) */
|
||||||
|
EXTERN CMMPAGEMAP_ROUTINES MmpPml2Routines;
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 3-level paging (PML3) */
|
||||||
|
EXTERN CMMPAGEMAP_ROUTINES MmpPml3Routines;
|
||||||
|
|
||||||
#endif /* __XTOSKRNL_I686_GLOBALS_H */
|
#endif /* __XTOSKRNL_I686_GLOBALS_H */
|
||||||
|
26
xtoskrnl/mm/amd64/globals.c
Normal file
26
xtoskrnl/mm/amd64/globals.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/mm/amd64/globals.c
|
||||||
|
* DESCRIPTION: AMD64-specific global variables for the Memory Manager
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 4-level paging (PML4) */
|
||||||
|
CMMPAGEMAP_ROUTINES MmpPml4Routines = {
|
||||||
|
// .ClearPte = MmpClearPte,
|
||||||
|
// .PteValid = MmpPml2PteValid,
|
||||||
|
// .SetPteCaching = MmpSetPml2PteCaching,
|
||||||
|
// .SetPte = MmpSetPml2Pte,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 5-level paging (PML5) */
|
||||||
|
CMMPAGEMAP_ROUTINES MmpPml5Routines = {
|
||||||
|
// .ClearPte = MmpClearPte,
|
||||||
|
// .PteValid = MmpPml3PteValid,
|
||||||
|
// .SetPteCaching = MmpSetPml3PteCaching,
|
||||||
|
// .SetPte = MmpSetPml3Pte,
|
||||||
|
};
|
@ -36,5 +36,8 @@ PVOID MmpHardwareHeapStart = MM_HARDWARE_HEAP_START_ADDRESS;
|
|||||||
/* Information about the current page map */
|
/* Information about the current page map */
|
||||||
MMPAGEMAP_INFO MmpPageMapInfo;
|
MMPAGEMAP_INFO MmpPageMapInfo;
|
||||||
|
|
||||||
|
/* Pointers to page map routines for the current paging mode */
|
||||||
|
PCMMPAGEMAP_ROUTINES MmpPageMapRoutines;
|
||||||
|
|
||||||
/* Number of used hardware allocation descriptors */
|
/* Number of used hardware allocation descriptors */
|
||||||
ULONG MmpUsedHardwareAllocationDescriptors = 0;
|
ULONG MmpUsedHardwareAllocationDescriptors = 0;
|
||||||
|
26
xtoskrnl/mm/i686/globals.c
Normal file
26
xtoskrnl/mm/i686/globals.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/mm/i686/globals.c
|
||||||
|
* DESCRIPTION: i686-specific global variables for the Memory Manager
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 2-level paging (PML2) */
|
||||||
|
CMMPAGEMAP_ROUTINES MmpPml2Routines = {
|
||||||
|
.ClearPte = MmpClearPte,
|
||||||
|
.PteValid = MmpPml2PteValid,
|
||||||
|
.SetPteCaching = MmpSetPml2PteCaching,
|
||||||
|
.SetPte = MmpSetPml2Pte,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Page mapping routines for systems using 3-level paging (PML3) */
|
||||||
|
CMMPAGEMAP_ROUTINES MmpPml3Routines = {
|
||||||
|
.ClearPte = MmpClearPte,
|
||||||
|
.PteValid = MmpPml3PteValid,
|
||||||
|
.SetPteCaching = MmpSetPml3PteCaching,
|
||||||
|
.SetPte = MmpSetPml3Pte,
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user