All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] x86: simplify ljmp to 32-bit code
@ 2019-12-03  5:28 Masahiro Yamada
  2019-12-08 10:43 ` Bin Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2019-12-03  5:28 UTC (permalink / raw)
  To: u-boot

You can directly specify the label as the operand for ljmp.

This commit saves 4-byte code.

Signed-off-by: Masahiro Yamada <masahiroy@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
 
 	/* 48-bit far pointer */
 code32start:
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] x86: simplify ljmp to 32-bit code
  2019-12-03  5:28 [U-Boot] [PATCH] x86: simplify ljmp to 32-bit code Masahiro Yamada
@ 2019-12-08 10:43 ` Bin Meng
  2019-12-08 11:08   ` Bin Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2019-12-08 10:43 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On Tue, Dec 3, 2019 at 1:29 PM Masahiro Yamada <masahiroy@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@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@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

Regards,
Bin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] x86: simplify ljmp to 32-bit code
  2019-12-08 10:43 ` Bin Meng
@ 2019-12-08 11:08   ` Bin Meng
  0 siblings, 0 replies; 3+ messages in thread
From: Bin Meng @ 2019-12-08 11:08 UTC (permalink / raw)
  To: u-boot

On Sun, Dec 8, 2019 at 6:43 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Masahiro,
>
> On Tue, Dec 3, 2019 at 1:29 PM Masahiro Yamada <masahiroy@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@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 `*'

fixed the warning by adding * before code32start

>
> >
> >         /* 48-bit far pointer */
> >  code32start:
> > --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>

and applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-08 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  5:28 [U-Boot] [PATCH] x86: simplify ljmp to 32-bit code Masahiro Yamada
2019-12-08 10:43 ` Bin Meng
2019-12-08 11:08   ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.