Re: [PATCH v2 02/16] x86/compressed: efi-mixed: move 32-bit entrypoint code into .text section

Borislav Petkov
2022-10-06T10:42:32Z

On Wed, Sep 21, 2022 at 04:54:08PM +0200, Ard Biesheuvel wrote:
> Move the code that stores the arguments passed to the EFI entrypoint
> into the .text section, so that it can be moved into a separate
> compilation unit in a subsequent patch.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/x86/boot/compressed/head_64.S | 34 ++++++++++++--------
> 1 file changed, 20 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
> index d33f060900d2..1ba2fc2357e6 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -303,24 +303,28 @@ SYM_FUNC_START(efi32_stub_entry)
> popl %ecx
> popl %edx
> popl %esi
> + jmp efi32_entry
> +SYM_FUNC_END(efi32_stub_entry)
>
> + .text
> +SYM_FUNC_START_LOCAL(efi32_entry)
> call 1f
> -1: pop %ebp
> - subl $ rva(1b), %ebp
> -
> - movl %esi, rva(efi32_boot_args+8)(%ebp)
> -SYM_INNER_LABEL(efi32_pe_stub_entry, SYM_L_LOCAL)
> - movl %ecx, rva(efi32_boot_args)(%ebp)
> - movl %edx, rva(efi32_boot_args+4)(%ebp)
> - movb $0, rva(efi_is64)(%ebp)
> +1: pop %ebx

I'm guessing according to the EFI mixed mode calling convention, %ebx is
not a live register which gets overwritten here...?

Looking at efi32_pe_entry() from where this is called, %ebx looks live.

What am I missing?

--
Regards/Gruss,
Boris.