mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] make the code simpler
@ 2013-12-02 17:17 u74147
  2013-12-03 10:25 ` Antony Pavlov
  0 siblings, 1 reply; 4+ messages in thread
From: u74147 @ 2013-12-02 17:17 UTC (permalink / raw)
  To: barebox

From: Du Huanpeng <u74147@gmail.com>


Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
 arch/mips/boot/start.S |   26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index 7e2ae5e..474407d 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -25,26 +25,6 @@
 #include <generated/compile.h>
 #include <generated/utsrelease.h>
 
-	/*
-	 * ADR macro instruction (inspired by ARM)
-	 *
-	 * ARM architecture doesn't have PC-relative jump instruction
-	 * like MIPS' B/BAL insns.  When ARM makes PC-relative jumps,
-	 * it uses ADR insn.  ADR is used to get a destination address
-	 * of 'label' against current PC.  With this, ARM can safely
-	 * make PC-relative jumps.
-	 */
-	.macro	ADR rd label temp
-	.set	push
-	.set	noreorder
-	move	\temp, ra			# preserve ra beforehand
-	bal	_pc
-	 nop
-_pc:	addiu	\rd, ra, \label - _pc		# label is assumed to be
-	move	ra, \temp			# within pc +/- 32KB
-	.set	pop
-	.endm
-
 	.set noreorder
 	.text
 	.section ".text_bare_init"
@@ -52,8 +32,9 @@ _pc:	addiu	\rd, ra, \label - _pc		# label is assumed to be
 
 EXPORT(_start)
 
-	b	__start
+	bal	__start
 	 nop
+_ra: 
 
 	.org	0x10
 	.ascii	"barebox " UTS_RELEASE " " UTS_VERSION
@@ -72,8 +53,7 @@ __start:
 	mtc0	k0, CP0_STATUS
 
 	/* copy barebox to link location */
-	ADR	a0, _start, t1	/* a0 <- pc-relative position of _start */
-
+	addiu	a0, ra, (_start - _ra)	/*a0 <- pc-relative position of _start  */
 	la	a1, _start	/* link (RAM) _start address */
 
 	beq	a0, a1, stack_setup
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-12-05  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 17:17 [PATCH] make the code simpler u74147
2013-12-03 10:25 ` Antony Pavlov
2013-12-04  6:09   ` [PATCH] MIPS: start.S: remove duplicate ADR macro definition Antony Pavlov
     [not found]     ` <CANvTkNb4Zj7Yv-poj4_J4iKQAU6HBS=-KJAe9v2nwGMMbaMJ5Q@mail.gmail.com>
     [not found]       ` <20131204203331.551f0276f8336f78e8becbcf@gmail.com>
     [not found]         ` <002101cef115$c762c7f0$562857d0$@gmail.com>
     [not found]           ` <20131205083451.faa1cb75348f65e400160b86@gmail.com>
2013-12-05  8:55             ` 答复: " Kevin Du Huanpeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox