Skip to contentSkip to conversation

arm64: use xzr to zero-out the bss section

PATCH New Masahiro Yamada 3 participants 6 messages Jan 27, 2017 – Feb 9, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm64: use xzr to zero-out the bss section

AArch64 has a zero register (xzr). Use it instead of x2.

---

 arch/arm/lib/crt0_64.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/lib/crt0_64.S +1 -2
index 91b19e0..f8e84b2 100644
@@ -117,9 +117,8 @@ relocation_return:
  */
 	ldr	x0, =__bss_start		/* this is auto-relocated! */
 	ldr	x1, =__bss_end			/* this is auto-relocated! */
-	mov	x2, #0
 clear_loop:
-	str	x2, [x0]
+	str	xzr, [x0]
 	add	x0, x0, #8
 	cmp	x0, x1
 	b.lo	clear_loop
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 arm64: use store with auto-increment

Save one instruction.

---

 arch/arm/lib/crt0_64.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/lib/crt0_64.S +1 -2
index f8e84b2..19c6a98 100644
@@ -118,8 +118,7 @@ relocation_return:
 	ldr	x0, =__bss_start		/* this is auto-relocated! */
 	ldr	x1, =__bss_end			/* this is auto-relocated! */
 clear_loop:
-	str	xzr, [x0]
-	add	x0, x0, #8
+	str	xzr, [x0], #8
 	cmp	x0, x1
 	b.lo	clear_loop
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH 2/2 arm64: use store with auto-increment

In reply to Masahiro Yamada
Quoted 4 lines · Masahiro Yamada

Save one instruction.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170208/983b0cf3/attachment.sig>
#5 lore raw

PATCH 1/2 arm64: use xzr to zero-out the bss section

In reply to Masahiro Yamada
Quoted 4 lines · Masahiro Yamada

AArch64 has a zero register (xzr). Use it instead of x2.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170208/4cddb40b/attachment.sig>