From: mdkinney Date: Tue, 28 Nov 2006 02:45:20 +0000 (+0000) Subject: Add JumpBuffer field to the static structure X-Git-Tag: edk2-stable201903~23853 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=6f4f08890de71e0c28fcc5f23b7f92cb55d6160e;hp=d57427a7f74cba303ff9cc82a1380f16ef07c52f Add JumpBuffer field to the static structure 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 --- diff --git a/EdkModulePkg/Core/Dxe/Image/Image.c b/EdkModulePkg/Core/Dxe/Image/Image.c index 0bef1ff82e..7810e6b093 100644 --- a/EdkModulePkg/Core/Dxe/Image/Image.c +++ b/EdkModulePkg/Core/Dxe/Image/Image.c @@ -74,6 +74,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage = { EFI_SUCCESS, // Status 0, // ExitDataSize NULL, // ExitData + NULL, // JumpBuffer NULL, // JumpContext 0, // Machine NULL, // Ebc @@ -949,12 +950,15 @@ Returns: // // Set long jump for Exit() support + // JumpContext must be aligned on a CPU specific boundary. + // Overallocate the buffer and force the required alignment // - Image->JumpContext = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext)); - if (Image->JumpContext == NULL) { + Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); + if (Image->JumpBuffer == NULL) { PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0); return EFI_OUT_OF_RESOURCES; } + Image->JumpContext = (VOID *)((UINTN)(ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT)) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); SetJumpFlag = SetJump (Image->JumpContext); // @@ -991,7 +995,7 @@ Returns: ASSERT (Image->Tpl == gEfiCurrentTpl); CoreRestoreTpl (Image->Tpl); - CoreFreePool (Image->JumpContext); + CoreFreePool (Image->JumpBuffer); // // Pop the current start image context