From a86aeaf228da739bce6bc40927949efc33672050 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 20 May 2016 23:28:23 +0200 Subject: 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 --- cmd/bootefi.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index d3a2331870..2a62dce702 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); } -- cgit v1.2.1