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

On Wed, 19 Apr 2023 at 20:25, Marvin Häuser <mhaeuser@posteo.de> wrote:


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.


Applying that commit made your branch work for me.

Yes, that might very well be - applying ae2c904 also "fixes" the issue as per https://github.com/mhaeuser/edk2/tree/arm_corruption-earliest-fixed

And technically, so does reverting this line :) https://github.com/mhaeuser/edk2/commit/7a96986e024f9c7ccf4774cc6f2ddb47a3abc86e#diff-1edfe01abdf8e4dcac640db4d9436e17b5f15d037714df7f365b58fcfc91e425R409

I don't understand how the changes would *fix* (rather than hide) the issue, so I'd attribute it to lucky codegen that doesn't misalign whatever is misaligned. I unfortunately have absolutely no time to get back to debugging this. :(

Best regards,
Marvin