]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
UefiCpuPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / UefiCpuPkg / Library / CpuExceptionHandlerLib / DxeException.c
index 9a72b37e77d57dd1befef7b3d6b18e17c5101ae5..fd59f09ecd082e21bd563b59cc9aee8bfe39fcc9 100644 (file)
@@ -2,13 +2,7 @@
   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
@@ -16,6 +10,7 @@
 #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
@@ -106,8 +101,12 @@ InitializeCpuInterruptHandlers (
   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
@@ -137,8 +136,13 @@ InitializeCpuInterruptHandlers (
 \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
@@ -260,7 +264,7 @@ InitializeCpuExceptionHandlersEx (
         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
@@ -275,7 +279,7 @@ InitializeCpuExceptionHandlersEx (
 \r
         InitData = &EssData;\r
       }\r
-      Status = ArchSetupExcpetionStack (InitData);\r
+      Status = ArchSetupExceptionStack (InitData);\r
     }\r
   }\r
 \r