bootefi: allow return without EFI_BOOT_SERVICES.Exit
The Unified Extensible Firmware Interface Specification, version 2.7,
defines in chapter 2.1.2 - UEFI Application that an EFI application may
either directly return or call EFI_BOOT_SERVICES.Exit().
Unfortunately U-Boot makes the incorrect assumption that
EFI_BOOT_SERVICES.Exit() is always called.
So the following application leads to a memory exception on the aarch64
architecture when returning:
EFI_STATUS efi_main(
EFI_HANDLE handle,
EFI_SYSTEM_TABlE systable) {
return EFI_SUCCESS;
}
With this patch the entry point is stored in the image handle.
The new wrapper function do_enter is used to call the EFI entry point.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
cc5b70812f
commit
b06d8ac39e
@@ -147,15 +147,28 @@ static void *copy_fdt(void *fdt)
|
||||
return new_fdt;
|
||||
}
|
||||
|
||||
static ulong efi_do_enter(void *image_handle,
|
||||
struct efi_system_table *st,
|
||||
asmlinkage ulong (*entry)(void *image_handle,
|
||||
struct efi_system_table *st))
|
||||
{
|
||||
efi_status_t ret = EFI_LOAD_ERROR;
|
||||
|
||||
if (entry)
|
||||
ret = entry(image_handle, st);
|
||||
st->boottime->exit(image_handle, ret, 0, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
static unsigned long efi_run_in_el2(ulong (*entry)(void *image_handle,
|
||||
struct efi_system_table *st), void *image_handle,
|
||||
struct efi_system_table *st)
|
||||
static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)(
|
||||
void *image_handle, struct efi_system_table *st),
|
||||
void *image_handle, struct efi_system_table *st)
|
||||
{
|
||||
/* Enable caches again */
|
||||
dcache_enable();
|
||||
|
||||
return entry(image_handle, st);
|
||||
return efi_do_enter(image_handle, st, entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -260,7 +273,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
|
||||
}
|
||||
#endif
|
||||
|
||||
return entry(&loaded_image_info, &systab);
|
||||
return efi_do_enter(&loaded_image_info, &systab, entry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user