From 0e18f584de59a86aaf86bd328dbd16fbd0175b3d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 24 Dec 2018 09:19:07 +0100 Subject: efi_loader: LoadImage: always allocate new pages If we want to properly unload images in Exit() the memory should always be allocated in the same way. As we allocate memory when reading from file we should do the same when the original image is in memory. A further patch will be needed to free the memory when Exit() is called. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 9dd933dae74..6a98981ebba 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -397,7 +397,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, struct efi_loaded_image_obj **handle_ptr, struct efi_loaded_image **info_ptr); efi_status_t efi_load_image_from_path(struct efi_device_path *file_path, - void **buffer); + void **buffer, efi_uintn_t *size); /* Print information about all loaded images */ void efi_print_image_infos(void *pc); -- cgit v1.2.3 From 8f7e2b2980a2d964db60a19a5d2ef8532caddf7d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 26 Dec 2018 12:49:09 +0100 Subject: 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 --- include/efi_loader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 6a98981ebba..3ce43f7a6f8 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -301,8 +301,8 @@ efi_status_t efi_set_watchdog(unsigned long timeout); /* Called from places to check whether a timer expired */ void efi_timer_check(void); /* PE loader implementation */ -void *efi_load_pe(struct efi_loaded_image_obj *handle, void *efi, - struct efi_loaded_image *loaded_image_info); +efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle, void *efi, + struct efi_loaded_image *loaded_image_info); /* Called once to store the pristine gd pointer */ void efi_save_gd(void); /* Special case handler for error/abort that just tries to dtrt to get -- cgit v1.2.3 From f69d63fae281ba98c3d063097cf4e95d17f3754d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 26 Dec 2018 13:28:09 +0100 Subject: efi_loader: use efi_start_image() for bootefi Remove the duplicate code in efi_do_enter() and use efi_start_image() to start the image invoked by the bootefi command. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 3ce43f7a6f8..512880ab8fb 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -320,6 +320,10 @@ efi_status_t efi_create_handle(efi_handle_t *handle); void efi_delete_handle(efi_handle_t obj); /* Call this to validate a handle and find the EFI object for it */ struct efi_object *efi_search_obj(const efi_handle_t handle); +/* Start image */ +efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle, + efi_uintn_t *exit_data_size, + u16 **exit_data); /* Find a protocol on a handle */ efi_status_t efi_search_protocol(const efi_handle_t handle, const efi_guid_t *protocol_guid, -- cgit v1.2.3