{
efi_status_t ret = EFI_SUCCESS;
+ /*
+ * On the ARM architecture gd is mapped to a fixed register (r9 or x18).
+ * As this register may be overwritten by an EFI payload we save it here
+ * and restore it on every callback entered.
+ */
+ efi_save_gd();
+
/* Initialize once only */
if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
return efi_obj_list_initialized;
if (ret != EFI_SUCCESS)
goto exit;
- /*
- * gd lives in a fixed register which may get clobbered while we execute
- * the payload. So save it here and restore it on every callback entry
- */
- efi_save_gd();
-
/* Transfer environment variable bootargs as load options */
set_load_options(loaded_image_info, "bootargs");
/* Load the EFI payload */
void *addr;
efi_status_t r;
- /*
- * gd lives in a fixed register which may get clobbered while we execute
- * the payload. So save it here and restore it on every callback entry
- */
- efi_save_gd();
-
addr = efi_bootmgr_load(&device_path, &file_path);
if (!addr)
return 1;
if (r != EFI_SUCCESS)
return CMD_RET_FAILURE;
- /*
- * gd lives in a fixed register which may get clobbered while we
- * execute the payload. So save it here and restore it on every
- * callback entry
- */
efi_save_gd();
/* Transfer environment variable efi_selftest as load options */
set_load_options(loaded_image_info, "efi_selftest");