mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
UefiCpuPkg: Fixed stack corruption.
This commit is contained in:
parent
b3bf2495f3
commit
2068113e8b
@ -659,6 +659,7 @@ InitializeMpExceptionStackSwitchHandlers (
|
|||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 *Buffer;
|
UINT8 *Buffer;
|
||||||
|
EFI_PHYSICAL_ADDRESS BufferAddress;
|
||||||
|
|
||||||
SwitchStackData = AllocateZeroPool (mNumberOfProcessors * sizeof (EXCEPTION_STACK_SWITCH_CONTEXT));
|
SwitchStackData = AllocateZeroPool (mNumberOfProcessors * sizeof (EXCEPTION_STACK_SWITCH_CONTEXT));
|
||||||
if (SwitchStackData == NULL) {
|
if (SwitchStackData == NULL) {
|
||||||
@ -697,19 +698,21 @@ InitializeMpExceptionStackSwitchHandlers (
|
|||||||
// we are allocating the buffer that will hold the new GDT and IDT for the APs. These must be allocated below
|
// we are allocating the buffer that will hold the new GDT and IDT for the APs. These must be allocated below
|
||||||
// 4GB as they are used by protected mode code on the APs when they are started up after this point. If they are
|
// 4GB as they are used by protected mode code on the APs when they are started up after this point. If they are
|
||||||
// above 4GB, the APs will triple fault because the 32 bit code segment is invalid
|
// above 4GB, the APs will triple fault because the 32 bit code segment is invalid
|
||||||
Buffer = (UINT8 *)(UINTN)(BASE_4GB - 1);
|
BufferAddress = BASE_4GB - 1;
|
||||||
Status = gBS->AllocatePages (
|
Status = gBS->AllocatePages (
|
||||||
AllocateMaxAddress,
|
AllocateMaxAddress,
|
||||||
EfiRuntimeServicesData,
|
EfiRuntimeServicesData,
|
||||||
EFI_SIZE_TO_PAGES (BufferSize),
|
EFI_SIZE_TO_PAGES (BufferSize),
|
||||||
(EFI_PHYSICAL_ADDRESS *)&Buffer
|
&BufferAddress
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR, "Failed to allocate buffer for InitializeExceptionStackSwitchHandlers Status %r\n", Status));
|
DEBUG ((DEBUG_ERROR, "Failed to allocate buffer for InitializeExceptionStackSwitchHandlers Status %r\n", Status));
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Buffer = (UINT8 *)(UINTN)BufferAddress;
|
||||||
|
|
||||||
ZeroMem (Buffer, BufferSize);
|
ZeroMem (Buffer, BufferSize);
|
||||||
|
|
||||||
BufferSize = 0;
|
BufferSize = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user