On 19. Apr 2023, at 20:03, Ard Biesheuvel <ardb@kernel.org> wrote:

Your branch seems to be missing 16e0969ef775b898ac700f3261d76030b8ab9ef0

"ArmVirtPkg/ArmVirtQemu: Use PEI flavor of ArmMmuLib for all PEIMs"

That's correct (because that commit is after the last commit I managed to reproduce the issue with), but I don't see how this commit would fix the issue. As I said, the symptom is that PeiCore memory is badly corrupted and the stall happens due to executing said corruption, not due to jumping to NULL. Those broken branches I linked can all be made work by rolling back the change to MemoryAllocationLib (which changes the code size, thus misaligns *something*). In fact, using the broken variant only for MemoryInitPei is sufficient to reproduce the issue, other modules don't seem to be involved.

Best regards,
Marvin