summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-05-20 21:28:23 (GMT)
committerTom Rini <trini@konsulko.com>2016-06-06 17:39:15 (GMT)
commita86aeaf228da739bce6bc40927949efc33672050 (patch)
tree2f3f9a7dbf3ad0228ed1423e91dec1c0ca37fda4 /cmd/bootefi.c
parent97d44b1f5c328af97d3c381c77858c8dd32c8e20 (diff)
downloadu-boot-fsl-qoriq-a86aeaf228da739bce6bc40927949efc33672050.tar.xz
efi_loader: Add exit support
Some times you may want to exit an EFI payload again, for example to default boot into a PXE installation and decide that you would rather want to boot from the local disk instead. This patch adds exit functionality to the EFI implementation, allowing EFI payloads to exit. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index d3a2331..2a62dce 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -209,6 +209,12 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
#ifdef DEBUG_EFI
printf("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
#endif
+
+ if (setjmp(&loaded_image_info.exit_jmp)) {
+ efi_status_t status = loaded_image_info.exit_status;
+ return status == EFI_SUCCESS ? 0 : -EINVAL;
+ }
+
return entry(&loaded_image_info, &systab);
}