2020-12-30 03:49:50

by Jiaxun Yang

[permalink] [raw]
Subject: [PATCH v3] MIPS: zboot: head.S clean up

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

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

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

start label is removed as it already defined in LEAF.

Reported-by: Paul Cercueil <[email protected]>
Signed-off-by: Jiaxun Yang <[email protected]>

--
v2: Remove start label (paul)
---
arch/mips/boot/compressed/head.S | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 409cb483a9ff..070b2fbabae4 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -15,10 +15,7 @@
#include <asm/asm.h>
#include <asm/regdef.h>

- .set noreorder
- .cprestore
LEAF(start)
-start:
/* Save boot rom start args */
move s0, a0
move s1, a1
@@ -35,21 +32,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.30.0


2020-12-31 00:31:06

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH v3] MIPS: zboot: head.S clean up

Reviewed-by: Huacai Chen <[email protected]>

On Wed, Dec 30, 2020 at 11:49 AM Jiaxun Yang <[email protected]> wrote:
>
> .cprestore is removed as we don't expect Position Independent
> zboot ELF.
>
> .noreorder is also removed and rest instructions are massaged
> to improve readability.
>
> t9 register is used for indirect jump as MIPS ABI requirement.
>
> start label is removed as it already defined in LEAF.
>
> Reported-by: Paul Cercueil <[email protected]>
> Signed-off-by: Jiaxun Yang <[email protected]>
>
> --
> v2: Remove start label (paul)
> ---
> arch/mips/boot/compressed/head.S | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
> index 409cb483a9ff..070b2fbabae4 100644
> --- a/arch/mips/boot/compressed/head.S
> +++ b/arch/mips/boot/compressed/head.S
> @@ -15,10 +15,7 @@
> #include <asm/asm.h>
> #include <asm/regdef.h>
>
> - .set noreorder
> - .cprestore
> LEAF(start)
> -start:
> /* Save boot rom start args */
> move s0, a0
> move s1, a1
> @@ -35,21 +32,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.30.0
>

2021-01-04 10:51:07

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3] MIPS: zboot: head.S clean up

On Wed, Dec 30, 2020 at 11:47:22AM +0800, Jiaxun Yang wrote:
> .cprestore is removed as we don't expect Position Independent
> zboot ELF.
>
> .noreorder is also removed and rest instructions are massaged
> to improve readability.
>
> t9 register is used for indirect jump as MIPS ABI requirement.
>
> start label is removed as it already defined in LEAF.
>
> Reported-by: Paul Cercueil <[email protected]>
> Signed-off-by: Jiaxun Yang <[email protected]>
>
> --
> v2: Remove start label (paul)
> ---
> arch/mips/boot/compressed/head.S | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]