I have developed code in EFI BIOS based on x86_64 platform, where BIOS downloads a bzImage.efi, does a LoadImage() and then StartImage(). It works fine most of the times. Both the BIOS and bzImage.efi images changes as I develop more stuff. Recently, I came across this problem where my bzImage.efi wouldn't work. That is, BIOS would download it, does LoadImage() and StartImage(); but after that it gets stuck. By stuck, I mean, it looks like it is in some infinite loop. I haven't instrumented my bzImage.efi to see if it is actually stuck there or in BIOS.
Funny part is, if I change my BIOS or bzImage.efi a little, the bzImage.efi would start working. By change, I'd add gBS->Stall() right before StartImage().
It looks like the memory layout of BIOS or bzImage.efi is at play. Can somebody please advice me as to what could be wrong?