Nate, GCC generates assembly code that uses `RBP` to store `Private` local variable for below C code in PeiCore/Dispatcher.c
```c if (StackOffsetPositive) { SecCoreData = (CONST EFI_SEC_PEI_HAND_OFF *)((UINTN)(VOID *)SecCoreData + StackOffset); Private = (PEI_CORE_INSTANCE *)((UINTN)(VOID *)Private + StackOffset); } else { SecCoreData = (CONST EFI_SEC_PEI_HAND_OFF *)((UINTN)(VOID *)SecCoreData - StackOffset); Private = (PEI_CORE_INSTANCE *)((UINTN)(VOID *)Private - StackOffset); } TemporaryRamSupportPpi->TemporaryRamMigration ( PeiServices, TemporaryRamBase, (EFI_PHYSICAL_ADDRESS)(UINTN)(TopOfNewStack - TemporaryStackSize), TemporaryRamSize ); PeiCore (SecCoreData, NULL, Private); ``` If `TemporaryRamMigration()` updates the `RBP` to point to physical memory by adding/subtracting the `StackOffset`, that results the Private is added/subtracted by `StackOffset` twice: One in the C code before calling TemporayRamSupport PPI, the other in `TemporaryRamMigration ()`. Since `FspSecMain.SecSwitchStack()` does update the `RBP`, have you met the similar issue? The issue doesn't always happen. It depends on whether `RBP` is used to store either `SecCoreData` or `Private`. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#98355): https://edk2.groups.io/g/devel/message/98355 Mute This Topic: https://groups.io/mt/31319621/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-