We support EFI-enabled systems only and such machines should support PAE, so there is no need for XTLDR to support non-PAE x86 hardware
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
fcfa575bff
commit
9dc0e60f28
@ -12,26 +12,8 @@
|
|||||||
#include "xtcommon.h"
|
#include "xtcommon.h"
|
||||||
|
|
||||||
|
|
||||||
/* Page Table entry structure definition */
|
/* Page Table entry structure definition (with PAE support) */
|
||||||
typedef struct _HARDWARE_PTE
|
typedef struct _HARDWARE_PTE
|
||||||
{
|
|
||||||
UINT32 Valid:1;
|
|
||||||
UINT32 Write:1;
|
|
||||||
UINT32 Owner:1;
|
|
||||||
UINT32 WriteThrough:1;
|
|
||||||
UINT32 CacheDisable:1;
|
|
||||||
UINT32 Accessed:1;
|
|
||||||
UINT32 Dirty:1;
|
|
||||||
UINT32 LargePage:1;
|
|
||||||
UINT32 Global:1;
|
|
||||||
UINT32 CopyOnWrite:1;
|
|
||||||
UINT32 Prototype:1;
|
|
||||||
UINT32 Reserved:1;
|
|
||||||
UINT32 PageFrameNumber:20;
|
|
||||||
} HARDWARE_PTE, *PHARDWARE_PTE;
|
|
||||||
|
|
||||||
/* Page Table entry with PAE support structure definition */
|
|
||||||
typedef struct _HARDWARE_PTE_PAE
|
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Write:1;
|
ULONGLONG Write:1;
|
||||||
@ -49,6 +31,6 @@ typedef struct _HARDWARE_PTE_PAE
|
|||||||
ULONGLONG Reserved1:12;
|
ULONGLONG Reserved1:12;
|
||||||
ULONGLONG SoftwareWsIndex:11;
|
ULONGLONG SoftwareWsIndex:11;
|
||||||
ULONGLONG NoExecute:1;
|
ULONGLONG NoExecute:1;
|
||||||
} HARDWARE_PTE_PAE, *PHARDWARE_PTE_PAE;
|
} HARDWARE_PTE, *PHARDWARE_PTE;
|
||||||
|
|
||||||
#endif /* __XTDK_I686_MMTYPES_H */
|
#endif /* __XTDK_I686_MMTYPES_H */
|
||||||
|
@ -149,7 +149,7 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
{
|
{
|
||||||
/* Map memory */
|
/* Map memory */
|
||||||
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
|
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
|
||||||
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages, FALSE, PtePointer);
|
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages, PtePointer);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory mapping failed */
|
/* Memory mapping failed */
|
||||||
@ -207,7 +207,6 @@ BlMapVirtualMemory(IN PLIST_ENTRY MemoryMappings,
|
|||||||
IN UINT_PTR VirtualAddress,
|
IN UINT_PTR VirtualAddress,
|
||||||
IN UINT_PTR PhysicalAddress,
|
IN UINT_PTR PhysicalAddress,
|
||||||
IN UINT NumberOfPages,
|
IN UINT NumberOfPages,
|
||||||
IN BOOLEAN PaeExtension,
|
|
||||||
IN OUT PVOID *PtePointer)
|
IN OUT PVOID *PtePointer)
|
||||||
{
|
{
|
||||||
PHARDWARE_PTE PageDirectoryPointTable, PageDirectory, PageTable;
|
PHARDWARE_PTE PageDirectoryPointTable, PageDirectory, PageTable;
|
||||||
|
@ -86,7 +86,6 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
PLOADER_MEMORY_MAPPING Mapping;
|
PLOADER_MEMORY_MAPPING Mapping;
|
||||||
PEFI_MEMORY_MAP MemoryMap;
|
PEFI_MEMORY_MAP MemoryMap;
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
BOOLEAN PaeExtension;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PVOID Stack;
|
PVOID Stack;
|
||||||
UINT Index;
|
UINT Index;
|
||||||
@ -103,7 +102,12 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
HlCpuId(CpuRegisters);
|
HlCpuId(CpuRegisters);
|
||||||
|
|
||||||
/* Store PAE status from the CPUID results */
|
/* Store PAE status from the CPUID results */
|
||||||
PaeExtension = CpuRegisters->Edx & CPUID_FEATURES_EDX_PAE;
|
if(!(CpuRegisters->Edx & CPUID_FEATURES_EDX_PAE))
|
||||||
|
{
|
||||||
|
/* No PAE support */
|
||||||
|
BlDbgPrint(L"ERROR: PAE extension not supported by the CPU\n");
|
||||||
|
return STATUS_EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate and zero-fill buffer for EFI memory map */
|
/* Allocate and zero-fill buffer for EFI memory map */
|
||||||
BlEfiMemoryAllocatePool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
BlEfiMemoryAllocatePool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
||||||
@ -121,99 +125,75 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
Descriptor = MemoryMap->Map;
|
Descriptor = MemoryMap->Map;
|
||||||
DescriptorCount = MemoryMap->MapSize / MemoryMap->DescriptorSize;
|
DescriptorCount = MemoryMap->MapSize / MemoryMap->DescriptorSize;
|
||||||
|
|
||||||
/* Check if PAE supported by the underlying hardware */
|
/* Calculate physical address based on KSEG0 base */
|
||||||
if(PaeExtension)
|
PhysicalAddress = (UINT_PTR)VirtualAddress - KSEG0_BASE;
|
||||||
|
|
||||||
|
/* Iterate over all descriptors from memory map to find satisfying address for PDPT */
|
||||||
|
for(Index = 0; Index < DescriptorCount; Index++)
|
||||||
{
|
{
|
||||||
/* Print debug message */
|
/* Check descriptor if it can be used to store PDPT */
|
||||||
BlDbgPrint(L"Physical Address Extension (PAE) available\n");
|
if((Descriptor->PhysicalStart + ((Descriptor->NumberOfPages - 1) * EFI_PAGE_SIZE) >= PhysicalAddress) &&
|
||||||
|
(Descriptor->Type == EfiConventionalMemory))
|
||||||
/* Calculate physical address based on KSEG0 base */
|
|
||||||
PhysicalAddress = (UINT_PTR)VirtualAddress - KSEG0_BASE;
|
|
||||||
|
|
||||||
/* Iterate over all descriptors from memory map to find satisfying address for PDPT */
|
|
||||||
for(Index = 0; Index < DescriptorCount; Index++)
|
|
||||||
{
|
{
|
||||||
/* Check descriptor if it can be used to store PDPT */
|
/* Use highest address possible */
|
||||||
if((Descriptor->PhysicalStart + ((Descriptor->NumberOfPages - 1) * EFI_PAGE_SIZE) >= PhysicalAddress) &&
|
if(PhysicalAddress >= Descriptor->PhysicalStart)
|
||||||
(Descriptor->Type == EfiConventionalMemory))
|
|
||||||
{
|
{
|
||||||
/* Use highest address possible */
|
/* Use physical address */
|
||||||
if(PhysicalAddress >= Descriptor->PhysicalStart)
|
PDPTAddress = PhysicalAddress;
|
||||||
{
|
}
|
||||||
/* Use physical address */
|
else
|
||||||
PDPTAddress = PhysicalAddress;
|
{
|
||||||
}
|
/* Use descriptor physical start as PDPT address */
|
||||||
else
|
PDPTAddress = Descriptor->PhysicalStart;
|
||||||
{
|
|
||||||
/* Use descriptor physical start as PDPT address */
|
|
||||||
PDPTAddress = Descriptor->PhysicalStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate pages for the PDPT address */
|
|
||||||
Status = BlEfiMemoryAllocatePages(1, &PDPTAddress);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get next descriptor */
|
/* Allocate pages for the PDPT address */
|
||||||
Descriptor = (EFI_MEMORY_DESCRIPTOR*)((UINT8*)Descriptor + MemoryMap->DescriptorSize);
|
Status = BlEfiMemoryAllocatePages(1, &PDPTAddress);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure PDPT address found */
|
/* Get next descriptor */
|
||||||
if(PDPTAddress == 0)
|
Descriptor = (EFI_MEMORY_DESCRIPTOR*)((UINT8*)Descriptor + MemoryMap->DescriptorSize);
|
||||||
{
|
|
||||||
/* No suitable area for PDPT found in EFI memory map */
|
|
||||||
return STATUS_EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set virtual address based on new PDPT address mapped to KSEG0 base */
|
|
||||||
VirtualAddress = (PVOID)(UINT_PTR)(PDPTAddress + EFI_PAGE_SIZE + KSEG0_BASE);
|
|
||||||
|
|
||||||
/* Set base page frame number */
|
|
||||||
Address = 0x100000;
|
|
||||||
|
|
||||||
/* Allocate pages for the PFN */
|
|
||||||
Status = BlEfiMemoryAllocatePages(4, &Address);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory allocation failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set and zero memory used by page mappings and CR3 */
|
|
||||||
*PtePointer = (PVOID)(UINT_PTR)PDPTAddress;
|
|
||||||
RtlZeroMemory(*PtePointer, EFI_PAGE_SIZE);
|
|
||||||
RtlZeroMemory((PVOID)Address, EFI_PAGE_SIZE * 4);
|
|
||||||
|
|
||||||
/* Set the page directory into the PDPT and mark it present */
|
|
||||||
for(Index = 0; Index < 4; Index++)
|
|
||||||
{
|
|
||||||
/* Set paging entry settings */
|
|
||||||
((PHARDWARE_PTE_PAE)*PtePointer)[Index].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
|
||||||
((PHARDWARE_PTE_PAE)*PtePointer)[Index].Valid = 1;
|
|
||||||
|
|
||||||
/* Next valid PFN address */
|
|
||||||
Address += EFI_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
/* Make sure PDPT address found */
|
||||||
|
if(PDPTAddress == 0)
|
||||||
{
|
{
|
||||||
/* Print debug message */
|
/* No suitable area for PDPT found in EFI memory map */
|
||||||
BlDbgPrint(L"Physical Address Extension (PAE) NOT available\n");
|
return STATUS_EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate pages for Page Directory */
|
/* Set virtual address based on new PDPT address mapped to KSEG0 base */
|
||||||
Status = BlEfiMemoryAllocatePages(1, &Address);
|
VirtualAddress = (PVOID)(UINT_PTR)(PDPTAddress + EFI_PAGE_SIZE + KSEG0_BASE);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory allocation failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set and zero memory used by Page Directory */
|
/* Set base page frame number */
|
||||||
*PtePointer = (PVOID)(UINT_PTR)Address;
|
Address = 0x100000;
|
||||||
RtlZeroMemory(*PtePointer, EFI_PAGE_SIZE);
|
|
||||||
|
/* Allocate pages for the PFN */
|
||||||
|
Status = BlEfiMemoryAllocatePages(4, &Address);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory allocation failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set and zero memory used by page mappings and CR3 */
|
||||||
|
*PtePointer = (PVOID)(UINT_PTR)PDPTAddress;
|
||||||
|
RtlZeroMemory(*PtePointer, EFI_PAGE_SIZE);
|
||||||
|
RtlZeroMemory((PVOID)Address, EFI_PAGE_SIZE * 4);
|
||||||
|
|
||||||
|
/* Set the page directory into the PDPT and mark it present */
|
||||||
|
for(Index = 0; Index < 4; Index++)
|
||||||
|
{
|
||||||
|
/* Set paging entry settings */
|
||||||
|
((PHARDWARE_PTE)*PtePointer)[Index].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
||||||
|
((PHARDWARE_PTE)*PtePointer)[Index].Valid = 1;
|
||||||
|
|
||||||
|
/* Next valid PFN address */
|
||||||
|
Address += EFI_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Map the stack */
|
/* Map the stack */
|
||||||
@ -255,8 +235,7 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
{
|
{
|
||||||
/* Map memory */
|
/* Map memory */
|
||||||
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
|
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
|
||||||
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages,
|
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages, PtePointer);
|
||||||
PaeExtension, PtePointer);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory mapping failed */
|
/* Memory mapping failed */
|
||||||
@ -276,12 +255,8 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
|
|||||||
EfiSystemTable->RuntimeServices->SetVirtualAddressMap(MemoryMap->MapSize, MemoryMap->DescriptorSize,
|
EfiSystemTable->RuntimeServices->SetVirtualAddressMap(MemoryMap->MapSize, MemoryMap->DescriptorSize,
|
||||||
MemoryMap->DescriptorVersion, MemoryMap->Map);
|
MemoryMap->DescriptorVersion, MemoryMap->Map);
|
||||||
|
|
||||||
/* Enable PAE if supported by CPU */
|
/* Enable Physical Address Extension (PAE) */
|
||||||
if(PaeExtension)
|
HlWriteControlRegister(4, HlReadControlRegister(4) | 0x00000020);
|
||||||
{
|
|
||||||
/* Enable Physical Address Extension (PAE) */
|
|
||||||
HlWriteControlRegister(4, HlReadControlRegister(4) | 0x00000020);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write page mappings to CR3 */
|
/* Write page mappings to CR3 */
|
||||||
HlWriteControlRegister(3, (UINT_PTR)*PtePointer);
|
HlWriteControlRegister(3, (UINT_PTR)*PtePointer);
|
||||||
@ -324,117 +299,61 @@ BlMapVirtualMemory(IN PLIST_ENTRY MemoryMappings,
|
|||||||
IN UINT_PTR VirtualAddress,
|
IN UINT_PTR VirtualAddress,
|
||||||
IN UINT_PTR PhysicalAddress,
|
IN UINT_PTR PhysicalAddress,
|
||||||
IN UINT NumberOfPages,
|
IN UINT NumberOfPages,
|
||||||
IN BOOLEAN PaeExtension,
|
|
||||||
IN OUT PVOID *PtePointer)
|
IN OUT PVOID *PtePointer)
|
||||||
{
|
{
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
UINT_PTR PageFrameNumber;
|
UINT_PTR PageFrameNumber;
|
||||||
PHARDWARE_PTE_PAE PaePageTable, PageDirectory;
|
PHARDWARE_PTE PageTable, PageDirectory;
|
||||||
PHARDWARE_PTE PageTable;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
unsigned int PdIndex, PtIndex;
|
unsigned int PdIndex, PtIndex;
|
||||||
|
|
||||||
/* Set the PFN */
|
/* Set the PFN */
|
||||||
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
||||||
|
|
||||||
/* Check if PAE supported by the hardware */
|
/* Do the recursive mapping */
|
||||||
if(PaeExtension)
|
while(NumberOfPages > 0)
|
||||||
{
|
{
|
||||||
/* PAE supported, do the recursive mapping */
|
/* Find Page Directory and calculate indices from a virtual address */
|
||||||
while(NumberOfPages > 0)
|
PageDirectory = (PHARDWARE_PTE)(UINT_PTR)(((PHARDWARE_PTE)(*PtePointer))[VirtualAddress >> 30].PageFrameNumber * EFI_PAGE_SIZE);
|
||||||
{
|
PdIndex = (VirtualAddress >> 21) & 0x1FF;
|
||||||
/* Find Page Directory and calculate indices from a virtual address */
|
PtIndex = (VirtualAddress & 0x1FF000) >> 12;
|
||||||
PageDirectory = (HARDWARE_PTE_PAE*)(((PHARDWARE_PTE_PAE)(*PtePointer))[VirtualAddress >> 30].PageFrameNumber * EFI_PAGE_SIZE);
|
|
||||||
PdIndex = (VirtualAddress >> 21) & 0x1FF;
|
|
||||||
PtIndex = (VirtualAddress & 0x1FF000) >> 12;
|
|
||||||
|
|
||||||
/* Validate Page Directory */
|
/* Validate Page Directory */
|
||||||
if(!PageDirectory[PdIndex].Valid) {
|
if(!PageDirectory[PdIndex].Valid) {
|
||||||
/* Allocate pages for new page table */
|
/* Allocate pages for new page table */
|
||||||
Status = BlEfiMemoryAllocatePages(1, &Address);
|
Status = BlEfiMemoryAllocatePages(1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS) {
|
if(Status != STATUS_EFI_SUCCESS) {
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill allocated memory with zeros */
|
|
||||||
RtlZeroMemory((PVOID)(UINT_PTR)Address, EFI_PAGE_SIZE);
|
|
||||||
|
|
||||||
/* Set paging entry settings */
|
|
||||||
PageDirectory[PdIndex].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
|
||||||
PageDirectory[PdIndex].Valid = 1;
|
|
||||||
PageDirectory[PdIndex].Write = 1;
|
|
||||||
|
|
||||||
/* Set page table */
|
|
||||||
PaePageTable = (HARDWARE_PTE_PAE*)(UINT_PTR)Address;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Set page table */
|
|
||||||
PaePageTable = (HARDWARE_PTE_PAE*)(PageDirectory[PdIndex].PageFrameNumber * EFI_PAGE_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set page table settings */
|
/* Fill allocated memory with zeros */
|
||||||
PaePageTable[PtIndex].PageFrameNumber = PageFrameNumber;
|
RtlZeroMemory((PVOID)(UINT_PTR)Address, EFI_PAGE_SIZE);
|
||||||
PaePageTable[PtIndex].Valid = 1;
|
|
||||||
PaePageTable[PtIndex].Write = 1;
|
|
||||||
|
|
||||||
/* Take next virtual address and PFN */
|
/* Set paging entry settings */
|
||||||
VirtualAddress += EFI_PAGE_SIZE;
|
PageDirectory[PdIndex].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
||||||
PageFrameNumber++;
|
PageDirectory[PdIndex].Valid = 1;
|
||||||
|
PageDirectory[PdIndex].Write = 1;
|
||||||
|
|
||||||
/* Decrease number of pages left */
|
/* Set page table */
|
||||||
NumberOfPages--;
|
PageTable = (PHARDWARE_PTE)(UINT_PTR)Address;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
/* PAE not supported, do the recursive mapping */
|
|
||||||
while (NumberOfPages > 0)
|
|
||||||
{
|
{
|
||||||
/* Calculate indices from a virtual address */
|
/* Set page table */
|
||||||
PdIndex = VirtualAddress >> 22;
|
PageTable = (PHARDWARE_PTE)(UINT_PTR)(PageDirectory[PdIndex].PageFrameNumber * EFI_PAGE_SIZE);
|
||||||
PtIndex = (VirtualAddress & 0x3FF000) >> 12;
|
|
||||||
|
|
||||||
/* Validate Page Table */
|
|
||||||
if(!((PHARDWARE_PTE)(*PtePointer))[PdIndex].Valid)
|
|
||||||
{
|
|
||||||
/* Allocate pages for new page table */
|
|
||||||
Status = BlEfiMemoryAllocatePages(1, &Address);
|
|
||||||
if (Status != STATUS_EFI_SUCCESS) {
|
|
||||||
/* Memory allocation failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill allocated memory with zeros */
|
|
||||||
RtlZeroMemory((PVOID)(UINT_PTR)Address, EFI_PAGE_SIZE);
|
|
||||||
|
|
||||||
/* Set paging entry settings */
|
|
||||||
((PHARDWARE_PTE)(*PtePointer))[PdIndex].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
|
||||||
((PHARDWARE_PTE)(*PtePointer))[PdIndex].Valid = 1;
|
|
||||||
((PHARDWARE_PTE)(*PtePointer))[PdIndex].Write = 1;
|
|
||||||
|
|
||||||
/* Set page table */
|
|
||||||
PageTable = (HARDWARE_PTE*)(UINT_PTR)Address;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Set page table */
|
|
||||||
PageTable = (HARDWARE_PTE*)(((PHARDWARE_PTE)(*PtePointer))[PdIndex].PageFrameNumber * EFI_PAGE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set page table settings */
|
|
||||||
PageTable[PtIndex].PageFrameNumber = PageFrameNumber;
|
|
||||||
PageTable[PtIndex].Valid = 1;
|
|
||||||
PageTable[PtIndex].Write = 1;
|
|
||||||
|
|
||||||
/* Take next virtual address and PFN */
|
|
||||||
VirtualAddress += EFI_PAGE_SIZE;
|
|
||||||
PageFrameNumber++;
|
|
||||||
|
|
||||||
/* Decrease number of pages left */
|
|
||||||
NumberOfPages--;
|
|
||||||
}
|
}
|
||||||
|
/* Set page table settings */
|
||||||
|
PageTable[PtIndex].PageFrameNumber = PageFrameNumber;
|
||||||
|
PageTable[PtIndex].Valid = 1;
|
||||||
|
PageTable[PtIndex].Write = 1;
|
||||||
|
|
||||||
|
/* Take next virtual address and PFN */
|
||||||
|
VirtualAddress += EFI_PAGE_SIZE;
|
||||||
|
PageFrameNumber++;
|
||||||
|
|
||||||
|
/* Decrease number of pages left */
|
||||||
|
NumberOfPages--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
|
@ -23,7 +23,7 @@ typedef EFI_STATUS (*PBL_FREE_POOL)(IN PVOID Memory);
|
|||||||
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
||||||
typedef EFI_STATUS (*PBL_GET_VIRTUAL_ADDRESS)(IN PLIST_ENTRY MemoryMappings, IN PVOID PhysicalAddress, OUT PVOID *VirtualAddress);
|
typedef EFI_STATUS (*PBL_GET_VIRTUAL_ADDRESS)(IN PLIST_ENTRY MemoryMappings, IN PVOID PhysicalAddress, OUT PVOID *VirtualAddress);
|
||||||
typedef EFI_STATUS (*PBL_INIT_VIRTUAL_MEMORY)(IN OUT PLIST_ENTRY MemoryMappings, IN OUT PVOID *MemoryMapAddress);
|
typedef EFI_STATUS (*PBL_INIT_VIRTUAL_MEMORY)(IN OUT PLIST_ENTRY MemoryMappings, IN OUT PVOID *MemoryMapAddress);
|
||||||
typedef EFI_STATUS (*PBL_MAP_VIRTUAL_MEMORY)(IN PLIST_ENTRY MemoryMappings, IN UINT_PTR VirtualAddress, IN UINT_PTR PhysicalAddress, IN UINT NumberOfPages, IN BOOLEAN PaeExtension, IN OUT PVOID *PtePointer);
|
typedef EFI_STATUS (*PBL_MAP_VIRTUAL_MEMORY)(IN PLIST_ENTRY MemoryMappings, IN UINT_PTR VirtualAddress, IN UINT_PTR PhysicalAddress, IN UINT NumberOfPages, IN OUT PVOID *PtePointer);
|
||||||
typedef VOID (*PBL_GET_STACK)(OUT PVOID *Stack);
|
typedef VOID (*PBL_GET_STACK)(OUT PVOID *Stack);
|
||||||
typedef VOID (*PBL_DBG_PRINT)(IN PUINT16 Format, IN ...);
|
typedef VOID (*PBL_DBG_PRINT)(IN PUINT16 Format, IN ...);
|
||||||
typedef VOID (*PBL_EFI_PRINT)(IN PUINT16 Format, IN ...);
|
typedef VOID (*PBL_EFI_PRINT)(IN PUINT16 Format, IN ...);
|
||||||
|
@ -169,7 +169,6 @@ BlMapVirtualMemory(IN PLIST_ENTRY MemoryMappings,
|
|||||||
IN UINT_PTR VirtualAddress,
|
IN UINT_PTR VirtualAddress,
|
||||||
IN UINT_PTR PhysicalAddress,
|
IN UINT_PTR PhysicalAddress,
|
||||||
IN UINT NumberOfPages,
|
IN UINT NumberOfPages,
|
||||||
IN BOOLEAN PaeExtension,
|
|
||||||
IN OUT PVOID *PtePointer);
|
IN OUT PVOID *PtePointer);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
|
Loading…
Reference in New Issue
Block a user