summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>2010-01-19 14:41:55 +0100
committerWolfgang Denk <wd@denx.de>2010-01-26 19:30:12 +0100
commitfc4e188789b01dc9f18c80869c43fdd7d1a51378 (patch)
treebff9ddbb66b0e5946f1bf73da1021f3ce1befc0d /include
parent2903ad33a71251a3a87485b5b185852c8998f209 (diff)
downloadu-boot-imx-fc4e188789b01dc9f18c80869c43fdd7d1a51378.zip
u-boot-imx-fc4e188789b01dc9f18c80869c43fdd7d1a51378.tar.gz
u-boot-imx-fc4e188789b01dc9f18c80869c43fdd7d1a51378.tar.bz2
ppc: Loose GOT access in IRQ
Using the GOT in IRQ handlers requires r14 to be -ffixed-r14. Avoid this by relocatate transfer_to_handler too. This will allow to free up r14 later on. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Diffstat (limited to 'include')
-rw-r--r--include/ppc_asm.tmpl47
1 files changed, 22 insertions, 25 deletions
diff --git a/include/ppc_asm.tmpl b/include/ppc_asm.tmpl
index 0019d46..fa5c5f6 100644
--- a/include/ppc_asm.tmpl
+++ b/include/ppc_asm.tmpl
@@ -257,46 +257,43 @@
* OFFSET values only; they must be relocated first before they can
* be used!
*/
-#define STD_EXCEPTION(n, label, hdlr) \
- . = n; \
-label: \
- EXCEPTION_PROLOG(SRR0, SRR1); \
- lwz r3,GOT(transfer_to_handler); \
- mtlr r3; \
- addi r3,r1,STACK_FRAME_OVERHEAD; \
- li r20,MSR_KERNEL; \
+#define COPY_EE(d, s) rlwimi d,s,0,16,16
+#define NOCOPY(d, s)
+#define EXC_XFER_TEMPLATE(label, hdlr, msr, copyee) \
+ bl 1f; \
+1: mflr r20; \
+ lwz r20,(.L_ ## label)-1b+8(r20); \
+ mtlr r20; \
+ li r20,msr; \
+ copyee(r20,r23); \
rlwimi r20,r23,0,25,25; \
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 STD_EXCEPTION(n, label, hdlr) \
+ . = n; \
+label: \
+ EXCEPTION_PROLOG(SRR0, SRR1); \
+ addi r3,r1,STACK_FRAME_OVERHEAD; \
+ EXC_XFER_TEMPLATE(label, hdlr, MSR_KERNEL, NOCOPY) \
#define CRIT_EXCEPTION(n, label, hdlr) \
. = n; \
label: \
EXCEPTION_PROLOG(CSRR0, CSRR1); \
- lwz r3,GOT(transfer_to_handler); \
- mtlr r3; \
addi r3,r1,STACK_FRAME_OVERHEAD; \
- li r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)); \
- rlwimi r20,r23,0,25,25; \
- blrl; \
-.L_ ## label : \
- .long hdlr - _start + _START_OFFSET; \
- .long crit_return - _start + _START_OFFSET
+ EXC_XFER_TEMPLATE(label, hdlr, \
+ MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE), NOCOPY) \
#define MCK_EXCEPTION(n, label, hdlr) \
. = n; \
label: \
EXCEPTION_PROLOG(MCSRR0, MCSRR1); \
- lwz r3,GOT(transfer_to_handler); \
- mtlr r3; \
addi r3,r1,STACK_FRAME_OVERHEAD; \
- li r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)); \
- rlwimi r20,r23,0,25,25; \
- blrl; \
-.L_ ## label : \
- .long hdlr - _start + _START_OFFSET; \
- .long mck_return - _start + _START_OFFSET
+ EXC_XFER_TEMPLATE(label, hdlr, \
+ MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE), NOCOPY) \
#endif /* __PPC_ASM_TMPL__ */