]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
UefiCpuPkg/CpuExceptionHandlerLib: alloc code memory for exception handlers
[mirror_edk2.git] / UefiCpuPkg / Library / CpuExceptionHandlerLib / DxeException.c
index 9a72b37e77d57dd1befef7b3d6b18e17c5101ae5..6d1b54d31d3dc5b38dbc38a4570f364c12f0f115 100644 (file)
@@ -16,6 +16,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 +107,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 +142,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