From 6f4f08890de71e0c28fcc5f23b7f92cb55d6160e Mon Sep 17 00:00:00 2001 From: mdkinney Date: Tue, 28 Nov 2006 02:45:20 +0000 Subject: [PATCH 1/1] 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 --- EdkModulePkg/Core/Dxe/Image/Image.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.39.2