Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2012 22:43:01 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        arm@freebsd.org
Subject:   Request for Review:  improving Ubldr syscall linkage.
Message-ID:  <1BB6F5DA-36E9-471A-8926-F56275D90962@kientzle.com>

next in thread | raw e-mail | index | archive | help
Any comments on the following before I commit?

Basically, this just:
  * Removes some redundant loads
  * Uses blx for the subroutine call
  * Uses bx for the subroutine return

The only odd point:  The ARM reference I have lists blx
only for ARMv6 and ARMv7 instruction sets =85 or am I
misreading that somehow?

It seems to work, but my only ARM board is ARMv7 and
I don't want to screw up anything for older CPUs.

Index: sys/boot/arm/uboot/start.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm/uboot/start.S	(revision 234747)
+++ sys/boot/arm/uboot/start.S	(working copy)
@@ -49,30 +49,22 @@
  * syscall()
  */
 ENTRY(syscall)
-	/* Save caller's lr */
+	/* Save caller's lr and r8 */
 	ldr	ip, =3Dsaved_regs
 	str	lr, [ip, #4]
-	/* Save loader's r8 */
-	ldr	ip, =3Dsaved_regs
 	str	r8, [ip, #8]
-
 	/* Restore U-Boot's r8 */
-	ldr	ip, =3Dsaved_regs
 	ldr	r8, [ip, #0]
 	/* Call into U-Boot */
-	ldr	lr, =3Dreturn_from_syscall
 	ldr	ip, =3Dsyscall_ptr
-	ldr	pc, [ip]
-
-return_from_syscall:
-	/* Restore loader's r8 */
+	ldr	ip, [ip, #0]
+	blx	ip
+	/* Restore loader's r8 and lr */
 	ldr	ip, =3Dsaved_regs
 	ldr	r8, [ip, #8]
-	/* Restore caller's lr */
-	ldr	ip, =3Dsaved_regs
 	ldr	lr, [ip, #4]
 	/* Return to caller */
-	mov	pc, lr
+	bx	lr
=20
 /*
  * Data section




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1BB6F5DA-36E9-471A-8926-F56275D90962>