[PATCH] x86: simplify ljmp to 32-bit code

Bin Meng bmeng.cn at gmail.com
Sun Dec 8 11:43:36 CET 2019


Hi Masahiro,

On Tue, Dec 3, 2019 at 1:29 PM Masahiro Yamada <masahiroy at kernel.org> wrote:
>
> You can directly specify the label as the operand for ljmp.
>
> This commit saves 4-byte code.
>
> Signed-off-by: Masahiro Yamada <masahiroy at kernel.org>
> ---
>
>  arch/x86/cpu/start16.S | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
> index bcabd76741ef..7bad9f3e4d87 100644
> --- a/arch/x86/cpu/start16.S
> +++ b/arch/x86/cpu/start16.S
> @@ -44,10 +44,8 @@ data32 cs    lgdt    gdt_ptr
>  ff:
>
>         /* Finally restore BIST and jump to the 32-bit initialization code */
> -       movw    $code32start, %ax
> -       movw    %ax, %bp
>         movl    %ecx, %eax
> -data32 cs      ljmp    *(%bp)
> +data32 cs      ljmp    code32start

There should be a * before code32start, otherwise gas reportes:

arch/x86/cpu/start16.S: Assembler messages:
arch/x86/cpu/start16.S:48: Warning: indirect ljmp without `*'

>
>         /* 48-bit far pointer */
>  code32start:
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
Tested-by: Bin Meng <bmeng.cn at gmail.com>

Regards,
Bin


More information about the U-Boot mailing list