// Update the Startup AP in the FVH header block ZeroVector region.\r
//\r
BytePointer = (UINT8 *) ((UINTN) FvImage->FileImage);\r
- if (FvInfo->Size == 0x10000) {\r
+ if (FvInfo->Size <= 0x10000) {\r
BytePointer2 = m64kRecoveryStartupApDataArray;\r
- } else if (FvInfo->Size == 0x20000) {\r
+ } else if (FvInfo->Size <= 0x20000) {\r
BytePointer2 = m128kRecoveryStartupApDataArray;\r
- } else if (FvInfo->Size > 0x20000) {\r
+ } else {\r
BytePointer2 = m128kRecoveryStartupApDataArray;\r
//\r
// Find the position to place Ap reset vector, the offset\r
//\r
IpiVector = FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer);\r
DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", IpiVector);\r
+ if (IpiVector & 0xFFF != 0) {\r
+ Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");\r
+ return EFI_ABORTED;\r
+ }\r
IpiVector = IpiVector >> 12;\r
IpiVector = IpiVector & 0xFF;\r
\r