Unhandled exception when booting UEFI x86_64 system image Description of problem: I have a bootable Ubuntu 20.04-based operating system image that I typically flash to the internal storage of an embedded Intel Atom computer. When I try booting it under QEMU, I reach the GRUB boot menu, but when it attempts to start the kernel, it outputs: ``` ERROR:../target/i386/tcg/sysemu/excp_helper.c:517:raise_stage2: code should not be reached Bail out! ERROR:../target/i386/tcg/sysemu/excp_helper.c:517:raise_stage2: code should not be reached Aborted (core dumped) ``` The kernel settings configured in GRUB are: ``` linux /boot/vmlinuz-5.4.0-132-generic root=UUID=816fe083-fc26-4a0d-ae4a-68d1b16dfb66 ro console=uart,mmio32,0xd091c000 console=ttyS4,115200n8 console=tty0 ? initrd /boot/initrd.img-5.4.0-132-generic ``` If I run an older QEMU 4.2.1 that ships with Ubuntu: ``` !!!! X64 Exception Type - 0D(#GP - General Protection) CPU Apic ID - 00000000 !!!! ExceptionData - 0000000000000000 RIP - 0000000007F2CD0E, CS - 0000000000000038, RFLAGS - 0000000000200206 RAX - AFAFAFAFAFAFAFAF, RCX - 000000000657F408, RDX - AFAFAFAFAFAFAFAF RBX - 0000000000000288, RSP - 0000000007F1BC48, RBP - 0000000007F336A0 RSI - 0000000007F336F8, RDI - 0000000000001000 R8 - 000000000657F408, R9 - 0000000000000320, R10 - 0000000000000000 R11 - 0000000000000000, R12 - 0000000000000004, R13 - 000000000657F400 R14 - 0000000000000000, R15 - 0000000000000000 DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 GS - 0000000000000030, SS - 0000000000000030 CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 CR4 - 0000000000000668, CR8 - 0000000000000000 DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 GDTR - 0000000007BEEA98 0000000000000047, LDTR - 0000000000000000 IDTR - 00000000072D1018 0000000000000FFF, TR - 0000000000000000 FXSAVE_STATE - 0000000007F1B8A0 !!!! Find image based on IP(0x7F2CD0E) /build/edk2-xUnmxG/edk2-0~20191122.bd85bf54/Build/OvmfX64/RELEASE_GCC5/X64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll (ImageBase=0000000007F1D000, EntryPoint=0000000007F2FAAE) !!!! ```