efi_loader: set entry point in efi_load_pe()

Up to now efi_load_pe() returns the entry point or NULL in case of an
error. This does not allow to return correct error codes from LoadImage().

Let efi_load_pe() return a status code and fill in the entry point in the
corresponding field of the image object.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2018-12-26 12:49:09 +01:00
parent 0e18f584de
commit 8f7e2b2980
4 changed files with 29 additions and 31 deletions

View file

@ -266,9 +266,6 @@ static efi_status_t do_bootefi_exec(void *efi,
struct efi_loaded_image_obj *image_obj = NULL;
struct efi_loaded_image *loaded_image_info = NULL;
EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
struct efi_system_table *st);
/*
* Special case for efi payload not loaded from disk, such as
* 'bootefi hello' or for example payload loaded directly into
@ -300,11 +297,9 @@ static efi_status_t do_bootefi_exec(void *efi,
goto err_prepare;
/* Load the EFI payload */
entry = efi_load_pe(image_obj, efi, loaded_image_info);
if (!entry) {
ret = EFI_LOAD_ERROR;
ret = efi_load_pe(image_obj, efi, loaded_image_info);
if (ret != EFI_SUCCESS)
goto err_prepare;
}
if (memdp) {
struct efi_device_path_memory *mdp = (void *)memdp;
@ -319,14 +314,14 @@ static efi_status_t do_bootefi_exec(void *efi,
"{ro,boot}(blob)0000000000000000");
/* Call our payload! */
debug("%s: Jumping to 0x%p\n", __func__, entry);
debug("%s: Jumping to 0x%p\n", __func__, image_obj->entry);
if (setjmp(&image_obj->exit_jmp)) {
ret = image_obj->exit_status;
goto err_prepare;
}
ret = efi_do_enter(&image_obj->header, &systab, entry);
ret = efi_do_enter(&image_obj->header, &systab, image_obj->entry);
err_prepare:
/* image has returned, loaded-image obj goes *poof*: */