linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: zboot: head.S clean up
@ 2020-12-21 13:00 Jiaxun Yang
  2020-12-21 14:09 ` Paul Cercueil
  0 siblings, 1 reply; 3+ messages in thread
From: Jiaxun Yang @ 2020-12-21 13:00 UTC (permalink / raw)
  To: linux-mips; +Cc: Jiaxun Yang, Paul Cercueil, Thomas Bogendoerfer, linux-kernel

.cprestore is removed as we don't except Position Independent
zboot ELF.

.noreorder is also removed and rest instructions is massaged
to improve readability.

t9 register is used to indirect jump as MIPS ABI requirement.

Reported-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/boot/compressed/head.S | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 409cb483a9ff..977218c90bc8 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -15,8 +15,6 @@
 #include <asm/asm.h>
 #include <asm/regdef.h>
 
-	.set noreorder
-	.cprestore
 	LEAF(start)
 start:
 	/* Save boot rom start args */
@@ -35,21 +33,20 @@ start:
 	PTR_LA	a0, (.heap)	     /* heap address */
 	PTR_LA	sp, (.stack + 8192)  /* stack address */
 
-	PTR_LA	ra, 2f
-	PTR_LA	k0, decompress_kernel
-	jr	k0
-	 nop
+	PTR_LA	t9, decompress_kernel
+	jalr	t9
+
 2:
 	move	a0, s0
 	move	a1, s1
 	move	a2, s2
 	move	a3, s3
-	PTR_LI	k0, KERNEL_ENTRY
-	jr	k0
-	 nop
+	PTR_LI	t9, KERNEL_ENTRY
+	jalr	t9
+
 3:
 	b	3b
-	 nop
+
 	END(start)
 
 	.comm .heap,BOOT_HEAP_SIZE,4
-- 
2.29.2


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

* Re: [PATCH] MIPS: zboot: head.S clean up
  2020-12-21 13:00 [PATCH] MIPS: zboot: head.S clean up Jiaxun Yang
@ 2020-12-21 14:09 ` Paul Cercueil
  2020-12-21 14:18   ` Jiaxun Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Cercueil @ 2020-12-21 14:09 UTC (permalink / raw)
  To: Jiaxun Yang; +Cc: linux-mips, Thomas Bogendoerfer, linux-kernel

Hi Jiaxun,

Le lun. 21 déc. 2020 à 21:00, Jiaxun Yang <jiaxun.yang@flygoat.com> a 
écrit :
> .cprestore is removed as we don't except Position Independent
> zboot ELF.
> 
> .noreorder is also removed and rest instructions is massaged
> to improve readability.
> 
> t9 register is used to indirect jump as MIPS ABI requirement.
> 
> Reported-by: Paul Cercueil <paul@crapouillou.net>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/boot/compressed/head.S | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/mips/boot/compressed/head.S 
> b/arch/mips/boot/compressed/head.S
> index 409cb483a9ff..977218c90bc8 100644
> --- a/arch/mips/boot/compressed/head.S
> +++ b/arch/mips/boot/compressed/head.S
> @@ -15,8 +15,6 @@
>  #include <asm/asm.h>
>  #include <asm/regdef.h>
> 
> -	.set noreorder
> -	.cprestore
>  	LEAF(start)
>  start:

You can also remove the 'start' label, since it's declared inside the 
LEAF() macro as well. GNU's assembler won't mind, but LLVM will choke 
on that.

Cheers,
-Paul

>  	/* Save boot rom start args */
> @@ -35,21 +33,20 @@ start:
>  	PTR_LA	a0, (.heap)	     /* heap address */
>  	PTR_LA	sp, (.stack + 8192)  /* stack address */
> 
> -	PTR_LA	ra, 2f
> -	PTR_LA	k0, decompress_kernel
> -	jr	k0
> -	 nop
> +	PTR_LA	t9, decompress_kernel
> +	jalr	t9
> +
>  2:
>  	move	a0, s0
>  	move	a1, s1
>  	move	a2, s2
>  	move	a3, s3
> -	PTR_LI	k0, KERNEL_ENTRY
> -	jr	k0
> -	 nop
> +	PTR_LI	t9, KERNEL_ENTRY
> +	jalr	t9
> +
>  3:
>  	b	3b
> -	 nop
> +
>  	END(start)
> 
>  	.comm .heap,BOOT_HEAP_SIZE,4
> --
> 2.29.2
> 



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

* Re: [PATCH] MIPS: zboot: head.S clean up
  2020-12-21 14:09 ` Paul Cercueil
@ 2020-12-21 14:18   ` Jiaxun Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2020-12-21 14:18 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: linux-mips, Thomas Bogendoerfer, linux-kernel



On Mon, Dec 21, 2020, at 10:09 PM, Paul Cercueil wrote:
> Hi Jiaxun,
> 
> Le lun. 21 déc. 2020 à 21:00, Jiaxun Yang <jiaxun.yang@flygoat.com> a 
> écrit :
> > .cprestore is removed as we don't except Position Independent
> > zboot ELF.
> > 
> > .noreorder is also removed and rest instructions is massaged
> > to improve readability.
> > 
> > t9 register is used to indirect jump as MIPS ABI requirement.
> > 
> > Reported-by: Paul Cercueil <paul@crapouillou.net>
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > ---
> >  arch/mips/boot/compressed/head.S | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/arch/mips/boot/compressed/head.S 
> > b/arch/mips/boot/compressed/head.S
> > index 409cb483a9ff..977218c90bc8 100644
> > --- a/arch/mips/boot/compressed/head.S
> > +++ b/arch/mips/boot/compressed/head.S
> > @@ -15,8 +15,6 @@
> >  #include <asm/asm.h>
> >  #include <asm/regdef.h>
> > 
> > -	.set noreorder
> > -	.cprestore
> >  	LEAF(start)
> >  start:
> 
> You can also remove the 'start' label, since it's declared inside the 
> LEAF() macro as well. GNU's assembler won't mind, but LLVM will choke 
> on that.

Thanks, will do in v2!

I was trying to catch you on IRC but failed every time when it comes to my mind :-(

> 
> Cheers,
> -Paul
> 

- Jiaxun

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

end of thread, other threads:[~2020-12-21 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 13:00 [PATCH] MIPS: zboot: head.S clean up Jiaxun Yang
2020-12-21 14:09 ` Paul Cercueil
2020-12-21 14:18   ` Jiaxun Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).