efi/x86: Avoid using code32_start

code32_start is meant for 16-bit real-mode bootloaders to inform the
kernel where the 32-bit protected mode code starts. Nothing in the
protected mode kernel except the EFI stub uses it.

efi_main() currently returns boot_params, with code32_start set inside it
to tell efi_stub_entry() where startup_32 is located. Since it was invoked
by efi_stub_entry() in the first place, boot_params is already known.
Return the address of startup_32 instead.

This will allow a 64-bit kernel to live above 4Gb, for example, and it's
cleaner as well.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200301230436.2246909-5-nivedita@alum.mit.edu
Link: https://lore.kernel.org/r/20200308080859.21568-13-ardb@kernel.org
This commit is contained in:
Arvind Sankar
2020-03-08 09:08:43 +01:00
committed by Ingo Molnar
parent 3fab43318f
commit 8acf63efa1
4 changed files with 8 additions and 10 deletions

View File

@@ -703,10 +703,11 @@ static efi_status_t exit_boot(struct boot_params *boot_params, void *handle)
}
/*
* On success we return a pointer to a boot_params structure, and NULL
* on failure.
* On success, we return the address of startup_32, which has potentially been
* relocated by efi_relocate_kernel.
* On failure, we exit to the firmware via efi_exit instead of returning.
*/
struct boot_params *efi_main(efi_handle_t handle,
unsigned long efi_main(efi_handle_t handle,
efi_system_table_t *sys_table_arg,
struct boot_params *boot_params)
{
@@ -736,7 +737,6 @@ struct boot_params *efi_main(efi_handle_t handle,
goto fail;
}
}
hdr->code32_start = (u32)bzimage_addr;
/*
* efi_pe_entry() may have been called before efi_main(), in which
@@ -799,7 +799,7 @@ struct boot_params *efi_main(efi_handle_t handle,
goto fail;
}
return boot_params;
return bzimage_addr;
fail:
efi_printk("efi_main() failed!\n");