The local variable PpiArray[10] is declared in the middle
of the SEC module _ModuleEntryPoint() with its own scope.
However, PpiArray has a dangling reference to its location
on the stack after the scope is closed. This causes issues
with some compilers (e.g. XCODE5).
The fix is to move the declaration of PpiArray[10] to
the beginning of the function, so it is scoped correctly
for all references to this local variable and references
to its location.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
EFI_PEI_PPI_DESCRIPTOR *SecPpiList;\r
UINTN SecReseveredMemorySize;\r
UINTN Index;\r
EFI_PEI_PPI_DESCRIPTOR *SecPpiList;\r
UINTN SecReseveredMemorySize;\r
UINTN Index;\r
+ EFI_PEI_PPI_DESCRIPTOR PpiArray[10];\r
\r
EMU_MAGIC_PAGE()->PpiList = PpiList;\r
ProcessLibraryConstructorList ();\r
\r
EMU_MAGIC_PAGE()->PpiList = PpiList;\r
ProcessLibraryConstructorList ();\r
SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + SecReseveredMemorySize);\r
SecCoreData->PeiTemporaryRamSize -= SecReseveredMemorySize;\r
#else\r
SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + SecReseveredMemorySize);\r
SecCoreData->PeiTemporaryRamSize -= SecReseveredMemorySize;\r
#else\r
- {\r
- //\r
- // When I subtrack from SecCoreData->PeiTemporaryRamBase PEI Core crashes? Either there is a bug\r
- // or I don't understand temp RAM correctly?\r
- //\r
- EFI_PEI_PPI_DESCRIPTOR PpiArray[10];\r
-\r
- SecPpiList = &PpiArray[0];\r
- ASSERT (sizeof (PpiArray) >= SecReseveredMemorySize);\r
- }\r
+ //\r
+ // When I subtrack from SecCoreData->PeiTemporaryRamBase PEI Core crashes? Either there is a bug\r
+ // or I don't understand temp RAM correctly?\r
+ //\r
+\r
+ SecPpiList = &PpiArray[0];\r
+ ASSERT (sizeof (PpiArray) >= SecReseveredMemorySize);\r
#endif\r
// Copy existing list, and append our entries.\r
CopyMem (SecPpiList, PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR) * Index);\r
#endif\r
// Copy existing list, and append our entries.\r
CopyMem (SecPpiList, PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR) * Index);\r