]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add JumpBuffer field to the static structure
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Nov 2006 02:45:20 +0000 (02:45 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Nov 2006 02:45:20 +0000 (02:45 +0000)
Align all Jump Context buffers according to the CPU specific alignment requirements

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2024 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Core/Dxe/Image/Image.c

index 0bef1ff82ed6aa12a0f85a294565f112d999ccea..7810e6b09393291c5e1a8d5bd5bf35114d72b2fc 100644 (file)
@@ -74,6 +74,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage  = {
   EFI_SUCCESS,                // Status\r
   0,                          // ExitDataSize\r
   NULL,                       // ExitData\r
+  NULL,                       // JumpBuffer\r
   NULL,                       // JumpContext\r
   0,                          // Machine\r
   NULL,                       // Ebc\r
@@ -949,12 +950,15 @@ Returns:
 \r
   //\r
   // Set long jump for Exit() support\r
+  // JumpContext must be aligned on a CPU specific boundary.\r
+  // Overallocate the buffer and force the required alignment\r
   //\r
-  Image->JumpContext = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext));\r
-  if (Image->JumpContext == NULL) {\r
+  Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);\r
+  if (Image->JumpBuffer == NULL) {\r
     PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+  Image->JumpContext = (VOID *)((UINTN)(ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT)) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);\r
 \r
   SetJumpFlag = SetJump (Image->JumpContext);\r
   //\r
@@ -991,7 +995,7 @@ Returns:
   ASSERT (Image->Tpl == gEfiCurrentTpl);\r
   CoreRestoreTpl (Image->Tpl);\r
 \r
-  CoreFreePool (Image->JumpContext);\r
+  CoreFreePool (Image->JumpBuffer);\r
 \r
   //\r
   // Pop the current start image context\r