summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 99c5a6ee0ca..90e9ead7b25 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -798,8 +798,15 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
EFI_ENTRY("%p, %ld, %ld, %p", image_handle, exit_status,
exit_data_size, exit_data);
+ /* Make sure entry/exit counts for EFI world cross-overs match */
__efi_exit_check();
+ /*
+ * But longjmp out with the U-Boot gd, not the application's, as
+ * the other end is a setjmp call inside EFI context.
+ */
+ efi_restore_gd();
+
loaded_image_info->exit_status = exit_status;
longjmp(&loaded_image_info->exit_jmp, 1);