UefiPayloadPkg: Don't Allocate Page 0
UefiPayloadPkg has copied the MdeModulePkg DxeIpl behavior to create a memory allocation HOB for page 0. That is being changed (see that commit for details), so also remove it here. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit is contained in:
committed by
mergify[bot]
parent
0277d5d8f1
commit
9280f16345
@@ -280,14 +280,6 @@ HandOffToDxeCore (
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
|
||||
|
||||
//
|
||||
// Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
|
||||
//
|
||||
if (IsNullDetectionEnabled ()) {
|
||||
ClearFirst4KPage (HobList.Raw);
|
||||
BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesData);
|
||||
}
|
||||
|
||||
BaseOfStack = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
|
||||
ASSERT (BaseOfStack != 0);
|
||||
|
||||
|
||||
@@ -278,14 +278,6 @@ HandOffToDxeCore (
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
|
||||
|
||||
//
|
||||
// Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
|
||||
//
|
||||
if (IsNullDetectionEnabled ()) {
|
||||
ClearFirst4KPage (HobList.Raw);
|
||||
BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesData);
|
||||
}
|
||||
|
||||
BaseOfStack = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
|
||||
ASSERT (BaseOfStack != 0);
|
||||
|
||||
|
||||
@@ -52,14 +52,6 @@ HandOffToDxeCore (
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
|
||||
|
||||
//
|
||||
// Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
|
||||
//
|
||||
if (IsNullDetectionEnabled ()) {
|
||||
ClearFirst4KPage (HobList.Raw);
|
||||
BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesData);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate 128KB for the Stack
|
||||
//
|
||||
|
||||
@@ -53,14 +53,6 @@ HandOffToDxeCore (
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
|
||||
|
||||
//
|
||||
// Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
|
||||
//
|
||||
if (IsNullDetectionEnabled ()) {
|
||||
ClearFirst4KPage (HobList.Raw);
|
||||
BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesData);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate 128KB for the Stack
|
||||
//
|
||||
|
||||
@@ -37,72 +37,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
PAGE_TABLE_POOL *mPageTablePool = NULL;
|
||||
|
||||
/**
|
||||
Clear legacy memory located at the first 4K-page, if available.
|
||||
|
||||
This function traverses the whole HOB list to check if memory from 0 to 4095
|
||||
exists and has not been allocated, and then clear it if so.
|
||||
|
||||
@param HobStart The start of HobList passed to DxeCore.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ClearFirst4KPage (
|
||||
IN VOID *HobStart
|
||||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS RscHob;
|
||||
EFI_PEI_HOB_POINTERS MemHob;
|
||||
BOOLEAN DoClear;
|
||||
|
||||
RscHob.Raw = HobStart;
|
||||
MemHob.Raw = HobStart;
|
||||
DoClear = FALSE;
|
||||
|
||||
//
|
||||
// Check if page 0 exists and free
|
||||
//
|
||||
while ((RscHob.Raw = GetNextHob (
|
||||
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR,
|
||||
RscHob.Raw
|
||||
)) != NULL)
|
||||
{
|
||||
if ((RscHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
|
||||
(RscHob.ResourceDescriptor->PhysicalStart == 0))
|
||||
{
|
||||
DoClear = TRUE;
|
||||
//
|
||||
// Make sure memory at 0-4095 has not been allocated.
|
||||
//
|
||||
while ((MemHob.Raw = GetNextHob (
|
||||
EFI_HOB_TYPE_MEMORY_ALLOCATION,
|
||||
MemHob.Raw
|
||||
)) != NULL)
|
||||
{
|
||||
if (MemHob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress
|
||||
< EFI_PAGE_SIZE)
|
||||
{
|
||||
DoClear = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
MemHob.Raw = GET_NEXT_HOB (MemHob);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
RscHob.Raw = GET_NEXT_HOB (RscHob);
|
||||
}
|
||||
|
||||
if (DoClear) {
|
||||
DEBUG ((DEBUG_INFO, "Clearing first 4K-page!\r\n"));
|
||||
SetMem (NULL, EFI_PAGE_SIZE, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Return configure status of NULL pointer detection feature.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user