grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] grub-core: Build fixes for i386


From: Matt Turner
Subject: Re: [PATCH v2] grub-core: Build fixes for i386
Date: Tue, 18 May 2021 13:06:09 -0700

On Tue, May 18, 2021 at 3:48 AM Jan (janneke) Nieuwenhuizen
<janneke@gnu.org> wrote:
>
> This fixes cross-compiling to x86 (e.g., the Hurd) from x86-linux.
>
> To reproduce, update the Grub source description in your local Guix
> archive and run
>
>    ./pre-inst-env guix build --system=i686-linux --target=i586-pc-gnu grub
>
> or install an x86 cross-build environment on x86-linux (32bit!) and
> configure to cross build and make, e.g., do something like
>
>     ./configure \
>        CC_FOR_BUILD=gcc \
>        --build=i686-unknown-linux-gnu
>        --host=i586-pc-gnu
>     make
>
> * grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386.
> ---
>  grub-core/lib/i386/relocator64.S | 27 +++++++++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/grub-core/lib/i386/relocator64.S 
> b/grub-core/lib/i386/relocator64.S
> index 148f38adb..b4675dd16 100644
> --- a/grub-core/lib/i386/relocator64.S
> +++ b/grub-core/lib/i386/relocator64.S
> @@ -63,8 +63,10 @@ VARIABLE(grub_relocator64_cr3)
>         movq    %rax, %cr3
>  #endif
>
>
> +#ifdef __x86_64__
>         .code64
> +#endif
>
>         /* mov imm64, %rax */
>         .byte   0x48
> @@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3)
>  VARIABLE(grub_relocator64_rsp)
>         .quad   0
>
> +#ifdef __x86_64__
>         movq    %rax, %rsp
> +#else
> +       /* movq %rax, %rsp */
> +       .byte   0x48
> +       .byte   0x89
> +       .byte   0xc4
> +#endif
>
>  #ifdef GRUB_MACHINE_EFI
>         jmp     LOCAL(skip_efi_stack_align)
> @@ -85,7 +94,14 @@ VARIABLE(grub_relocator64_rsp)
>          */
>  VARIABLE(grub_relocator64_efi_start)
>         /* Align the stack as UEFI spec requires. */
> +#ifdef __x86_64__
>         andq    $~15, %rsp
> +#else
> +       .byte 0x48
> +        .byte 0x83
> +        .byte 0xe4
> +        .byte 0xf0

Indentation on these lines is inconsistent.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]