diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2025-01-07 17:57:16 +0300 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2025-02-21 18:54:16 +0300 |
commit | eaed89559591f73ca06a3e6534c381e3bd948ee6 (patch) | |
tree | a97ca289d25e21535b68273a1137ebca75a2f6e5 | |
parent | dac628e9563640e2de7878decc03a508b1ba319a (diff) | |
download | linux-eaed89559591f73ca06a3e6534c381e3bd948ee6.tar.xz |
x86/efi/mixed: Check CPU compatibility without relying on verify_cpu()
In order for the EFI mixed mode startup code to be reusable in a context
where the legacy decompressor is not used, replace the call to
verify_cpu() [which performs an elaborate set of checks] with a simple
check against the 'long mode' bit in the appropriate CPUID leaf.
This is reasonable, given that EFI support is implied when booting in
this manner, and so there is no need to consider very old CPUs when
performing this check.
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r-- | arch/x86/boot/compressed/efi_mixed.S | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/arch/x86/boot/compressed/efi_mixed.S b/arch/x86/boot/compressed/efi_mixed.S index d681e30c6732..b7886e2591fc 100644 --- a/arch/x86/boot/compressed/efi_mixed.S +++ b/arch/x86/boot/compressed/efi_mixed.S @@ -279,24 +279,20 @@ SYM_FUNC_END(efi32_entry) * efi_system_table_32_t *sys_table) */ SYM_FUNC_START(efi32_pe_entry) - pushl %ebp - movl %esp, %ebp pushl %ebx // save callee-save registers - pushl %edi - - call verify_cpu // check for long mode support - testl %eax, %eax - movl $0x80000003, %eax // EFI_UNSUPPORTED - jnz 2f - movl 8(%ebp), %ecx // image_handle - movl 12(%ebp), %edx // sys_table + /* Check whether the CPU supports long mode */ + movl $0x80000001, %eax // assume extended info support + cpuid + btl $29, %edx // check long mode bit + jnc 1f + leal 8(%esp), %esp // preserve stack alignment + movl (%esp), %ecx // image_handle + movl 4(%esp), %edx // sys_table jmp efi32_entry // pass %ecx, %edx // no other registers remain live - -2: popl %edi // restore callee-save registers +1: movl $0x80000003, %eax // EFI_UNSUPPORTED popl %ebx - leave RET SYM_FUNC_END(efi32_pe_entry) |