[U-Boot] [PATCH] [RFC]mpc83xx: Remove need for -ffixed-r14

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Mon Sep 28 14:45:40 CEST 2009


Seems to me that the only need for -ffixed-r14 is to find
transfer_to_handler from whithin an IRQ.
Add transfer_to_handler to the trap relocation so the need for a GOT
access in IRQ context goes away.
NOTE: This will break other PPC archs until their start.S is
updated accordingly.
Comments?
---
 cpu/mpc83xx/config.mk |    2 +-
 cpu/mpc83xx/start.S   |   12 ++++++++++--
 include/ppc_asm.tmpl  |   18 ++++++++++++------
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/cpu/mpc83xx/config.mk b/cpu/mpc83xx/config.mk
index 2f0f1ce..19339a5 100644
--- a/cpu/mpc83xx/config.mk
+++ b/cpu/mpc83xx/config.mk
@@ -20,7 +20,7 @@
 # MA 02111-1307 USA
 #
 
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
+PLATFORM_RELFLAGS += -fPIC -meabi
 
 PLATFORM_CPPFLAGS += -DCONFIG_MPC83XX -DCONFIG_E300 \
 			-ffixed-r2 -msoft-float
diff --git a/cpu/mpc83xx/start.S b/cpu/mpc83xx/start.S
index 26e3106..3cbcd4c 100644
--- a/cpu/mpc83xx/start.S
+++ b/cpu/mpc83xx/start.S
@@ -341,12 +341,14 @@ Alignment:
 	li	r20,MSR_KERNEL
 	rlwimi	r20,r23,0,16,16		/* copy EE bit from saved MSR */
 	rlwimi	r20,r23,0,25,25		/* copy IP bit from saved MSR */
-	lwz	r6,GOT(transfer_to_handler)
+	li	r6,(.L_Alignment)@l
+	lwz	r6,8(r6)
 	mtlr	r6
 	blrl
 .L_Alignment:
 	.long	AlignmentException - _start + EXC_OFF_SYS_RESET
 	.long	int_return - _start + EXC_OFF_SYS_RESET
+	.long	transfer_to_handler - _start + EXC_OFF_SYS_RESET
 
 /* Program check exception */
 	. = 0x700
@@ -356,12 +358,14 @@ ProgramCheck:
 	li	r20,MSR_KERNEL
 	rlwimi	r20,r23,0,16,16		/* copy EE bit from saved MSR */
 	rlwimi	r20,r23,0,25,25		/* copy IP bit from saved MSR */
-	lwz	r6,GOT(transfer_to_handler)
+	li	r6,(.L_ProgramCheck)@l
+	lwz	r6,8(r6)
 	mtlr	r6
 	blrl
 .L_ProgramCheck:
 	.long	ProgramCheckException - _start + EXC_OFF_SYS_RESET
 	.long	int_return - _start + EXC_OFF_SYS_RESET
+	.long	transfer_to_handler - _start + EXC_OFF_SYS_RESET
 
 	STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -1096,6 +1100,10 @@ trap_reloc:
 	add	r0, r0, r3		/*  ... += dest_addr	*/
 	stw	r0, 4(r7)
 
+	lwz	r0, 8(r7)		/* transfer_to_handler ...	*/
+	add	r0, r0, r3		/*  ... += dest_addr	*/
+	stw	r0, 8(r7)
+
 	blr
 #endif /* !CONFIG_NAND_SPL */
 
diff --git a/include/ppc_asm.tmpl b/include/ppc_asm.tmpl
index 0019d46..b8eb03b 100644
--- a/include/ppc_asm.tmpl
+++ b/include/ppc_asm.tmpl
@@ -261,7 +261,8 @@
 	. = n;						\
 label:							\
 	EXCEPTION_PROLOG(SRR0, SRR1);			\
-	lwz	r3,GOT(transfer_to_handler);		\
+	li	r20,(.L_##label)@l;			\
+	lwz	r3,8(r20);				\
 	mtlr	r3;					\
 	addi	r3,r1,STACK_FRAME_OVERHEAD;		\
 	li	r20,MSR_KERNEL;				\
@@ -269,13 +270,15 @@ label:							\
 	blrl;						\
 .L_ ## label :						\
 	.long	hdlr - _start + _START_OFFSET;		\
-	.long	int_return - _start + _START_OFFSET
+	.long	int_return - _start + _START_OFFSET;	\
+	.long	transfer_to_handler - _start + _START_OFFSET
 
 #define CRIT_EXCEPTION(n, label, hdlr)				\
 	. = n;							\
 label:								\
 	EXCEPTION_PROLOG(CSRR0, CSRR1);				\
-	lwz	r3,GOT(transfer_to_handler);			\
+	li	r20,(.L_##label)@l;				\
+	lwz	r3,8(r20);					\
 	mtlr	r3;						\
 	addi	r3,r1,STACK_FRAME_OVERHEAD;			\
 	li	r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE));	\
@@ -283,13 +286,15 @@ label:								\
 	blrl;							\
 .L_ ## label :							\
 	.long	hdlr - _start + _START_OFFSET;			\
-	.long	crit_return - _start + _START_OFFSET
+	.long	crit_return - _start + _START_OFFSET;		\
+	.long	transfer_to_handler - _start + _START_OFFSET
 
 #define MCK_EXCEPTION(n, label, hdlr)				\
 	. = n;							\
 label:								\
 	EXCEPTION_PROLOG(MCSRR0, MCSRR1);			\
-	lwz	r3,GOT(transfer_to_handler);			\
+	li	r20,(.L_##label)@l;				\
+	lwz	r3,8(r20);					\
 	mtlr	r3;						\
 	addi	r3,r1,STACK_FRAME_OVERHEAD;			\
 	li	r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE));	\
@@ -297,6 +302,7 @@ label:								\
 	blrl;							\
 .L_ ## label :							\
 	.long	hdlr - _start + _START_OFFSET;			\
-	.long	mck_return - _start + _START_OFFSET
+	.long	mck_return - _start + _START_OFFSET;		\
+	.long	transfer_to_handler - _start + _START_OFFSET
 
 #endif	/* __PPC_ASM_TMPL__ */
-- 
1.6.4.4



More information about the U-Boot mailing list