CPU exception handler library implemenation for DXE modules.\r
\r
Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include "CpuExceptionCommon.h"\r
#include <Library/DebugLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
\r
CONST UINTN mDoFarReturnFlag = 0;\r
\r
RESERVED_VECTORS_DATA *ReservedVectors;\r
EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler;\r
\r
- ReservedVectors = AllocatePool (sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM);\r
- ASSERT (ReservedVectors != NULL);\r
+ Status = gBS->AllocatePool (\r
+ EfiBootServicesCode,\r
+ sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM,\r
+ (VOID **)&ReservedVectors\r
+ );\r
+ ASSERT (!EFI_ERROR (Status) && ReservedVectors != NULL);\r
SetMem ((VOID *) ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM, 0xff);\r
if (VectorInfo != NULL) {\r
Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, CPU_INTERRUPT_NUM);\r
\r
AsmGetTemplateAddressMap (&TemplateMap);\r
ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);\r
- InterruptEntryCode = AllocatePool (TemplateMap.ExceptionStubHeaderSize * CPU_INTERRUPT_NUM);\r
- ASSERT (InterruptEntryCode != NULL);\r
+\r
+ Status = gBS->AllocatePool (\r
+ EfiBootServicesCode,\r
+ TemplateMap.ExceptionStubHeaderSize * CPU_INTERRUPT_NUM,\r
+ (VOID **)&InterruptEntryCode\r
+ );\r
+ ASSERT (!EFI_ERROR (Status) && InterruptEntryCode != NULL);\r
\r
InterruptEntry = (UINTN) InterruptEntryCode;\r
for (Index = 0; Index < CPU_INTERRUPT_NUM; Index ++) {\r
AsmReadGdtr (&Gdtr);\r
\r
EssData.X64.Revision = CPU_EXCEPTION_INIT_DATA_REV;\r
- EssData.X64.KnownGoodStackTop = (UINTN)mNewStack;\r
+ EssData.X64.KnownGoodStackTop = (UINTN)mNewStack + sizeof (mNewStack);\r
EssData.X64.KnownGoodStackSize = CPU_KNOWN_GOOD_STACK_SIZE;\r
EssData.X64.StackSwitchExceptions = CPU_STACK_SWITCH_EXCEPTION_LIST;\r
EssData.X64.StackSwitchExceptionNumber = CPU_STACK_SWITCH_EXCEPTION_NUMBER;\r
\r
InitData = &EssData;\r
}\r
- Status = ArchSetupExcpetionStack (InitData);\r
+ Status = ArchSetupExceptionStack (InitData);\r
}\r
}\r
\r