[PATCH 10/28] efi/x86: Respect 32-bit ABI in efi32_pe_entry

From: Ard Biesheuvel
Date: Sun Mar 08 2020 - 04:09:47 EST


From: Arvind Sankar <nivedita@xxxxxxxxxxxx>

verify_cpu clobbers BX and DI. In case we have to return error, we need
to preserve them to respect 32-bit calling convention.

Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20200301230436.2246909-3-nivedita@xxxxxxxxxxxx
Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
---
arch/x86/boot/compressed/head_64.S | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 86c97797bf78..25fa763f4e83 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -660,7 +660,11 @@ SYM_DATA(efi_is64, .byte 1)
SYM_FUNC_START(efi32_pe_entry)
pushl %ebp

+ pushl %ebx
+ pushl %edi
call verify_cpu // check for long mode support
+ popl %edi
+ popl %ebx
testl %eax, %eax
movl $0x80000003, %eax // EFI_UNSUPPORTED
jnz 3f
--
2.17.1