forked from xt-sys/exectos
Rename LOADER_MEMORY_MAPPING structure to more meaningful LOADER_MEMORY_DESCRIPTOR
This commit is contained in:
parent
143803aad9
commit
5221db2e63
@ -93,13 +93,13 @@ typedef struct _LOADER_INFORMATION_BLOCK
|
|||||||
} LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
} LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
||||||
|
|
||||||
/* Boot Loader memory mapping information */
|
/* Boot Loader memory mapping information */
|
||||||
typedef struct _LOADER_MEMORY_MAPPING
|
typedef struct _LOADER_MEMORY_DESCRIPTOR
|
||||||
{
|
{
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
LOADER_MEMORY_TYPE MemoryType;
|
LOADER_MEMORY_TYPE MemoryType;
|
||||||
ULONG BasePage;
|
ULONG BasePage;
|
||||||
ULONG PageCount;
|
ULONG PageCount;
|
||||||
} LOADER_MEMORY_MAPPING, *PLOADER_MEMORY_MAPPING;
|
} LOADER_MEMORY_DESCRIPTOR, *PLOADER_MEMORY_DESCRIPTOR;
|
||||||
|
|
||||||
/* Loader provided information needed by the kernel to initialize */
|
/* Loader provided information needed by the kernel to initialize */
|
||||||
typedef struct _KERNEL_INITIALIZATION_BLOCK
|
typedef struct _KERNEL_INITIALIZATION_BLOCK
|
||||||
|
@ -244,7 +244,7 @@ typedef struct _LIST_ENTRY32 LIST_ENTRY32, *PLIST_ENTRY32;
|
|||||||
typedef struct _LIST_ENTRY64 LIST_ENTRY64, *PLIST_ENTRY64;
|
typedef struct _LIST_ENTRY64 LIST_ENTRY64, *PLIST_ENTRY64;
|
||||||
typedef struct _LOADER_GRAPHICS_INFORMATION_BLOCK LOADER_GRAPHICS_INFORMATION_BLOCK, *PLOADER_GRAPHICS_INFORMATION_BLOCK;
|
typedef struct _LOADER_GRAPHICS_INFORMATION_BLOCK LOADER_GRAPHICS_INFORMATION_BLOCK, *PLOADER_GRAPHICS_INFORMATION_BLOCK;
|
||||||
typedef struct _LOADER_INFORMATION_BLOCK LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
typedef struct _LOADER_INFORMATION_BLOCK LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
||||||
typedef struct _LOADER_MEMORY_MAPPING LOADER_MEMORY_MAPPING, *PLOADER_MEMORY_MAPPING;
|
typedef struct _LOADER_MEMORY_DESCRIPTOR LOADER_MEMORY_DESCRIPTOR, *PLOADER_MEMORY_DESCRIPTOR;
|
||||||
typedef struct _M128 M128, *PM128;
|
typedef struct _M128 M128, *PM128;
|
||||||
typedef struct _MMCOLOR_TABLES MMCOLOR_TABLES, *PMMCOLOR_TABLES;
|
typedef struct _MMCOLOR_TABLES MMCOLOR_TABLES, *PMMCOLOR_TABLES;
|
||||||
typedef struct _MMPFNENTRY MMPFNENTRY, *PMMPFNENTRY;
|
typedef struct _MMPFNENTRY MMPFNENTRY, *PMMPFNENTRY;
|
||||||
|
@ -73,7 +73,7 @@ XtGetMemoryDescriptorList(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
ULONGLONG Pages;
|
ULONGLONG Pages;
|
||||||
|
|
||||||
Pages = (ULONGLONG)EFI_SIZE_TO_PAGES((PageMap->MapSize + 1) * sizeof(LOADER_MEMORY_MAPPING));
|
Pages = (ULONGLONG)EFI_SIZE_TO_PAGES((PageMap->MapSize + 1) * sizeof(LOADER_MEMORY_DESCRIPTOR));
|
||||||
|
|
||||||
Status = XtLdrProtocol->Memory.AllocatePages(Pages, &Address);
|
Status = XtLdrProtocol->Memory.AllocatePages(Pages, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
@ -95,7 +95,7 @@ XtGetMemoryDescriptorList(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
while(ListEntry != &PageMap->MemoryMap)
|
while(ListEntry != &PageMap->MemoryMap)
|
||||||
{
|
{
|
||||||
PXTBL_MEMORY_MAPPING MemoryMapping = CONTAIN_RECORD(ListEntry, XTBL_MEMORY_MAPPING, ListEntry);
|
PXTBL_MEMORY_MAPPING MemoryMapping = CONTAIN_RECORD(ListEntry, XTBL_MEMORY_MAPPING, ListEntry);
|
||||||
PLOADER_MEMORY_MAPPING MemoryDescriptor = (PLOADER_MEMORY_MAPPING)Address;
|
PLOADER_MEMORY_DESCRIPTOR MemoryDescriptor = (PLOADER_MEMORY_DESCRIPTOR)Address;
|
||||||
|
|
||||||
MemoryDescriptor->MemoryType = MemoryMapping->MemoryType;
|
MemoryDescriptor->MemoryType = MemoryMapping->MemoryType;
|
||||||
MemoryDescriptor->BasePage = (UINT_PTR)MemoryMapping->PhysicalAddress / EFI_PAGE_SIZE;
|
MemoryDescriptor->BasePage = (UINT_PTR)MemoryMapping->PhysicalAddress / EFI_PAGE_SIZE;
|
||||||
@ -103,7 +103,7 @@ XtGetMemoryDescriptorList(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
RtlInsertTailList(MemoryDescriptorList, &MemoryDescriptor->ListEntry);
|
RtlInsertTailList(MemoryDescriptorList, &MemoryDescriptor->ListEntry);
|
||||||
|
|
||||||
Address = Address + sizeof(LOADER_MEMORY_MAPPING);
|
Address = Address + sizeof(LOADER_MEMORY_DESCRIPTOR);
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ EXTERN LIST_ENTRY KepSystemResourcesListHead;
|
|||||||
EXTERN KSPIN_LOCK KepSystemResourcesLock;
|
EXTERN KSPIN_LOCK KepSystemResourcesLock;
|
||||||
|
|
||||||
/* Biggest free memory descriptor */
|
/* Biggest free memory descriptor */
|
||||||
EXTERN PLOADER_MEMORY_MAPPING MmFreeDescriptor;
|
EXTERN PLOADER_MEMORY_DESCRIPTOR MmFreeDescriptor;
|
||||||
|
|
||||||
/* Highest physical page number */
|
/* Highest physical page number */
|
||||||
EXTERN ULONG_PTR MmHighestPhysicalPage;
|
EXTERN ULONG_PTR MmHighestPhysicalPage;
|
||||||
@ -61,7 +61,7 @@ EXTERN ULONG_PTR MmLowestPhysicalPage;
|
|||||||
EXTERN ULONG MmNumberOfPhysicalPages;
|
EXTERN ULONG MmNumberOfPhysicalPages;
|
||||||
|
|
||||||
/* Old biggest free memory descriptor */
|
/* Old biggest free memory descriptor */
|
||||||
EXTERN LOADER_MEMORY_MAPPING MmOldFreeDescriptor;
|
EXTERN LOADER_MEMORY_DESCRIPTOR MmOldFreeDescriptor;
|
||||||
|
|
||||||
/* Page Map Level */
|
/* Page Map Level */
|
||||||
EXTERN ULONG MmPageMapLevel;
|
EXTERN ULONG MmPageMapLevel;
|
||||||
@ -70,7 +70,7 @@ EXTERN ULONG MmPageMapLevel;
|
|||||||
EXTERN UCHAR MmProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE];
|
EXTERN UCHAR MmProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE];
|
||||||
|
|
||||||
/* Allocation descriptors dedicated for HAL */
|
/* Allocation descriptors dedicated for HAL */
|
||||||
EXTERN LOADER_MEMORY_MAPPING MmpHalAllocationDescriptors[MM_HAL_ALLOCATION_DESCRIPTORS];
|
EXTERN LOADER_MEMORY_DESCRIPTOR MmpHalAllocationDescriptors[MM_HAL_ALLOCATION_DESCRIPTORS];
|
||||||
|
|
||||||
/* Live address of kernel HAL heap */
|
/* Live address of kernel HAL heap */
|
||||||
EXTERN PVOID MmpHalHeapStart;
|
EXTERN PVOID MmpHalHeapStart;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Biggest free memory descriptor */
|
/* Biggest free memory descriptor */
|
||||||
PLOADER_MEMORY_MAPPING MmFreeDescriptor;
|
PLOADER_MEMORY_DESCRIPTOR MmFreeDescriptor;
|
||||||
|
|
||||||
/* Highest physical page number */
|
/* Highest physical page number */
|
||||||
ULONG_PTR MmHighestPhysicalPage;
|
ULONG_PTR MmHighestPhysicalPage;
|
||||||
@ -22,7 +22,7 @@ ULONG_PTR MmLowestPhysicalPage = -1;
|
|||||||
ULONG MmNumberOfPhysicalPages;
|
ULONG MmNumberOfPhysicalPages;
|
||||||
|
|
||||||
/* Old biggest free memory descriptor */
|
/* Old biggest free memory descriptor */
|
||||||
LOADER_MEMORY_MAPPING MmOldFreeDescriptor;
|
LOADER_MEMORY_DESCRIPTOR MmOldFreeDescriptor;
|
||||||
|
|
||||||
/* Page Map Level */
|
/* Page Map Level */
|
||||||
ULONG MmPageMapLevel;
|
ULONG MmPageMapLevel;
|
||||||
@ -31,7 +31,7 @@ ULONG MmPageMapLevel;
|
|||||||
UCHAR MmProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE] = {0};
|
UCHAR MmProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE] = {0};
|
||||||
|
|
||||||
/* Allocation descriptors dedicated for HAL */
|
/* Allocation descriptors dedicated for HAL */
|
||||||
LOADER_MEMORY_MAPPING MmpHalAllocationDescriptors[MM_HAL_ALLOCATION_DESCRIPTORS];
|
LOADER_MEMORY_DESCRIPTOR MmpHalAllocationDescriptors[MM_HAL_ALLOCATION_DESCRIPTORS];
|
||||||
|
|
||||||
/* Live address of kernel HAL heap */
|
/* Live address of kernel HAL heap */
|
||||||
PVOID MmpHalHeapStart = MM_HAL_HEAP_START_ADDRESS;
|
PVOID MmpHalHeapStart = MM_HAL_HEAP_START_ADDRESS;
|
||||||
|
@ -31,7 +31,7 @@ MmAllocateHalMemory(IN PFN_NUMBER PageCount,
|
|||||||
IN BOOLEAN Aligned,
|
IN BOOLEAN Aligned,
|
||||||
OUT PULONG_PTR Buffer)
|
OUT PULONG_PTR Buffer)
|
||||||
{
|
{
|
||||||
PLOADER_MEMORY_MAPPING Descriptor, ExtraDescriptor, HalDescriptor;
|
PLOADER_MEMORY_DESCRIPTOR Descriptor, ExtraDescriptor, HalDescriptor;
|
||||||
PFN_NUMBER Alignment, MaxPage;
|
PFN_NUMBER Alignment, MaxPage;
|
||||||
ULONGLONG PhysicalAddress;
|
ULONGLONG PhysicalAddress;
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
@ -53,7 +53,7 @@ MmAllocateHalMemory(IN PFN_NUMBER PageCount,
|
|||||||
ListEntry = KeInitializationBlock->MemoryDescriptorListHead.Flink;
|
ListEntry = KeInitializationBlock->MemoryDescriptorListHead.Flink;
|
||||||
while(ListEntry != &KeInitializationBlock->MemoryDescriptorListHead)
|
while(ListEntry != &KeInitializationBlock->MemoryDescriptorListHead)
|
||||||
{
|
{
|
||||||
Descriptor = CONTAIN_RECORD(ListEntry, LOADER_MEMORY_MAPPING, ListEntry);
|
Descriptor = CONTAIN_RECORD(ListEntry, LOADER_MEMORY_DESCRIPTOR, ListEntry);
|
||||||
|
|
||||||
/* Align memory to 64KB if needed */
|
/* Align memory to 64KB if needed */
|
||||||
Alignment = Aligned ? (((Descriptor->BasePage + 0x0F) & ~0x0F) - Descriptor->BasePage) : 0;
|
Alignment = Aligned ? (((Descriptor->BasePage + 0x0F) & ~0x0F) - Descriptor->BasePage) : 0;
|
||||||
|
@ -64,7 +64,7 @@ XTAPI
|
|||||||
VOID
|
VOID
|
||||||
MmpScanMemoryDescriptors(VOID)
|
MmpScanMemoryDescriptors(VOID)
|
||||||
{
|
{
|
||||||
PLOADER_MEMORY_MAPPING MemoryDescriptor;
|
PLOADER_MEMORY_DESCRIPTOR MemoryDescriptor;
|
||||||
PLIST_ENTRY MemoryMappings;
|
PLIST_ENTRY MemoryMappings;
|
||||||
PFN_NUMBER FreePages;
|
PFN_NUMBER FreePages;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ MmpScanMemoryDescriptors(VOID)
|
|||||||
while(MemoryMappings != &KeInitializationBlock->MemoryDescriptorListHead)
|
while(MemoryMappings != &KeInitializationBlock->MemoryDescriptorListHead)
|
||||||
{
|
{
|
||||||
/* Get memory descriptor */
|
/* Get memory descriptor */
|
||||||
MemoryDescriptor = CONTAIN_RECORD(MemoryMappings, LOADER_MEMORY_MAPPING, ListEntry);
|
MemoryDescriptor = CONTAIN_RECORD(MemoryMappings, LOADER_MEMORY_DESCRIPTOR, ListEntry);
|
||||||
|
|
||||||
/* Check if memory type is invisible or cached */
|
/* Check if memory type is invisible or cached */
|
||||||
if(MmpVerifyMemoryTypeInvisible(MemoryDescriptor->MemoryType) ||
|
if(MmpVerifyMemoryTypeInvisible(MemoryDescriptor->MemoryType) ||
|
||||||
@ -125,7 +125,7 @@ MmpScanMemoryDescriptors(VOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store original free descriptor */
|
/* Store original free descriptor */
|
||||||
RtlCopyMemory(&MmOldFreeDescriptor, MmFreeDescriptor, sizeof(LOADER_MEMORY_MAPPING));
|
RtlCopyMemory(&MmOldFreeDescriptor, MmFreeDescriptor, sizeof(LOADER_MEMORY_DESCRIPTOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks whether the specified memory type should be considered as free.
|
/** Checks whether the specified memory type should be considered as free.
|
||||||
|
Loading…
Reference in New Issue
Block a user