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
This commit is contained in:
Ard Biesheuvel
2020-01-13 18:22:33 +01:00
committed by Ingo Molnar
parent a786810cc8
commit 796eb8d26a
3 changed files with 10 additions and 13 deletions

View File

@@ -221,7 +221,7 @@ efi_status_t efi_set_virtual_address_map(unsigned long memory_map_size,
/* arch specific definitions used by the stub code */
__pure bool efi_is_64bit(void);
__attribute_const__ bool efi_is_64bit(void);
static inline bool efi_is_native(void)
{