diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2020-01-13 18:22:33 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-01-20 08:13:00 +0100 |
commit | 796eb8d26a57f917bf22d781666aeab491f5c4f1 (patch) | |
tree | 680ccf6ddb5f9298be52bb13f399fa4415edfbbc /arch/x86/boot/compressed/eboot.c | |
parent | Merge tag 'v5.5-rc7' into efi/core, to pick up fixes (diff) | |
download | linux-796eb8d26a57f917bf22d781666aeab491f5c4f1.tar.xz linux-796eb8d26a57f917bf22d781666aeab491f5c4f1.zip |
efi/libstub/x86: Use const attribute for efi_is_64bit()
Reshuffle the x86 stub code a bit so that we can tag the efi_is_64bit()
function with the 'const' attribute, which permits the compiler to
optimize away any redundant calls. Since we have two different entry
points for 32 and 64 bit firmware in the startup code, this also
simplifies the C code since we'll enter it with the efi_is64 variable
already set.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200113172245.27925-2-ardb@kernel.org
Diffstat (limited to 'arch/x86/boot/compressed/eboot.c')
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 4afd29eb5b34..ab3a40283db7 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -21,16 +21,18 @@ #include "eboot.h" static efi_system_table_t *sys_table; -static bool efi_is64 = IS_ENABLED(CONFIG_X86_64); +extern const bool efi_is64; __pure efi_system_table_t *efi_system_table(void) { return sys_table; } -__pure bool efi_is_64bit(void) +__attribute_const__ bool efi_is_64bit(void) { - return efi_is64; + if (IS_ENABLED(CONFIG_EFI_MIXED)) + return efi_is64; + return IS_ENABLED(CONFIG_X64_64); } static efi_status_t @@ -710,8 +712,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, void *handle) */ struct boot_params *efi_main(efi_handle_t handle, efi_system_table_t *sys_table_arg, - struct boot_params *boot_params, - bool is64) + struct boot_params *boot_params) { struct desc_ptr *gdt = NULL; struct setup_header *hdr = &boot_params->hdr; @@ -721,9 +722,6 @@ struct boot_params *efi_main(efi_handle_t handle, sys_table = sys_table_arg; - if (IS_ENABLED(CONFIG_EFI_MIXED)) - efi_is64 = is64; - /* Check if we were booted by the EFI firmware */ if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) goto fail; |