]> git.sur5r.net Git - u-boot/commitdiff
ppc: Loose GOT access in IRQ
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Tue, 19 Jan 2010 13:41:55 +0000 (14:41 +0100)
committerWolfgang Denk <wd@denx.de>
Tue, 26 Jan 2010 18:30:12 +0000 (19:30 +0100)
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>
15 files changed:
cpu/74xx_7xx/start.S
cpu/mpc512x/start.S
cpu/mpc5xx/start.S
cpu/mpc5xxx/start.S
cpu/mpc8220/start.S
cpu/mpc824x/start.S
cpu/mpc8260/start.S
cpu/mpc83xx/start.S
cpu/mpc85xx/start.S
cpu/mpc86xx/start.S
cpu/mpc8xx/start.S
cpu/ppc4xx/start.S
include/ppc_asm.tmpl
lib_ppc/Makefile
lib_ppc/reloc.S [new file with mode: 0644]

index 23381a35cd768515a2914d29ae8f3a9439e09d83..efcd95f692357c664d61470266774cd2c49e57b9 100644 (file)
@@ -132,28 +132,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        /* No FPU on MPC8xx.  This exception is not supposed to happen.
        */
@@ -837,23 +824,6 @@ trap_init:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       sync
-       isync
-
-       blr
-
 #ifdef CONFIG_SYS_INIT_RAM_LOCK
 lock_ram_in_cache:
        /* Allocate Initial RAM in data cache.
index 4edc8e94d92d55ec231bc3f99553a0f87b32e677..46c5efa053d90f126272f324472950e5780c79d6 100644 (file)
@@ -127,30 +127,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
 /* Floating Point Unit unavailable exception */
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
@@ -723,17 +708,3 @@ trap_init:
 
        mtlr    r4                      /* restore link register    */
        blr
-
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...             */
-       add     r0, r0, r3              /*  ... += dest_addr    */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...       */
-       add     r0, r0, r3              /*  ... += dest_addr    */
-       stw     r0, 4(r7)
-
-       blr
index 85ea7a88276631cc9ced7d3e699a9fece98e127d..be980a135641c152b2ec11ecaa4a12fa184b3623 100644 (file)
@@ -217,28 +217,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        /* FPU on MPC5xx available. We will use it later.
        */
@@ -563,24 +550,6 @@ trap_init:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       sync
-       isync
-
-       blr
-
-
 #if defined(CONFIG_PATI)
 /* Program the PLL */
 pll_prog_code_start:
index eb42939b7b6f504fc0315f7fefc0d36d1d99f5b7..075a7dd836180216ec118b6f1fc235dcef0cf797 100644 (file)
@@ -215,30 +215,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -797,17 +782,3 @@ trap_init:
 
        mtlr    r4                      /* restore link register    */
        blr
-
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       blr
index af9472d6b3d96c3714ffd09e59f7bfcd155fb0b6..5218c859dfc60a66f251f0751b2c5faefb9ce0ca 100644 (file)
@@ -176,30 +176,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -762,17 +747,3 @@ trap_init:
 
        mtlr    r4                  /* restore link register        */
        blr
-
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)           /* hdlr ...                     */
-       add     r0, r0, r3          /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)           /* int_return ...               */
-       add     r0, r0, r3          /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       blr
index 750457b02ad4ac8ce674574085faf6364ce116b0..7f4064816fc77e316d7d4c1d9f8e0df3cffdf2b9 100644 (file)
@@ -227,28 +227,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = EXC_OFF_PROGRAM
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        /* No FPU on MPC8xx. This exception is not supposed to happen.
        */
@@ -695,20 +682,6 @@ trap_init:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       blr
-
        /* Setup the BAT registers.
         */
 setup_bats:
index edb95e6a62aa2b8ac1533d337f51731dbb9eaa3a..7d80af5acd32a77b09e2e10e9bfc1e856454de06 100644 (file)
@@ -286,30 +286,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -1033,17 +1018,3 @@ trap_init:
 
        mtlr    r4                      /* restore link register    */
        blr
-
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       blr
index ee4b8624aaa58bdf47a9742ae9b25cf02b1c17de..5a50b090583ffed988682cc91536573a7643624c 100644 (file)
@@ -338,30 +338,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       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)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -1086,19 +1071,6 @@ trap_init:
        mtlr    r4                      /* restore link register    */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...             */
-       add     r0, r0, r3              /*  ... += dest_addr    */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...       */
-       add     r0, r0, r3              /*  ... += dest_addr    */
-       stw     r0, 4(r7)
-
-       blr
 #endif /* !CONFIG_NAND_SPL */
 
 #ifdef CONFIG_SYS_INIT_RAM_LOCK
index 7e60e67c3a434341f9dc753664f35c3f751f2636..d73c5c2315ea5f931cf9f5a262c921e9d9d01421 100644 (file)
@@ -415,28 +415,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + _START_OFFSET
-       .long   int_return - _start + _START_OFFSET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x0700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + _START_OFFSET
-       .long   int_return - _start + _START_OFFSET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        /* No FPU on MPC85xx.  This exception is not supposed to happen.
        */
@@ -1089,20 +1076,6 @@ trap_init:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0,0(r7)                /* hdlr ...                     */
-       add     r0,r0,r3                /*  ... += dest_addr            */
-       stw     r0,0(r7)
-
-       lwz     r0,4(r7)                /* int_return ...               */
-       add     r0,r0,r3                /*  ... += dest_addr            */
-       stw     r0,4(r7)
-
-       blr
-
 .globl unlock_ram_in_cache
 unlock_ram_in_cache:
        /* invalidate the INIT_RAM section */
index e65f1c0649ac689b76203746420631c113af0221..eaa2657d3872ada77298ced606efd564cd31acd1 100644 (file)
@@ -121,28 +121,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
 
@@ -848,23 +835,6 @@ trap_init:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       sync
-       isync
-
-       blr
-
 .globl enable_ext_addr
 enable_ext_addr:
        mfspr   r0, HID0
index e84326ebdc5518c18068c16df7bbb3d37fd91abd..24e9053f0ed1f7602d08b65aec0a22ebf3692794 100644 (file)
@@ -231,28 +231,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
        /* No FPU on MPC8xx.  This exception is not supposed to happen.
        */
@@ -694,20 +681,3 @@ trap_init:
 
        mtlr    r4                      /* restore link register        */
        blr
-
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       sync
-       isync
-
-       blr
index 46f65aa779b1fb0711bdd14b8cc38186d8fcc98e..2eb21fab42c7f9b388be7409eba6f66bb7642298 100644 (file)
@@ -574,28 +574,15 @@ Alignment:
        mfspr   r5,DSISR
        stw     r5,_DSISR(r21)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + _START_OFFSET
-       .long   int_return - _start + _START_OFFSET
+       EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
 
 /* Program check exception */
        . = 0x700
 ProgramCheck:
        EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + _START_OFFSET
-       .long   int_return - _start + _START_OFFSET
+       EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
+               MSR_KERNEL, COPY_EE)
 
 #ifdef CONFIG_440
        STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
@@ -1742,20 +1729,6 @@ __440_msr_continue:
        mtlr    r4                      /* restore link register        */
        blr
 
-       /*
-        * Function: relocate entries for one exception vector
-        */
-trap_reloc:
-       lwz     r0, 0(r7)               /* hdlr ...                     */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 0(r7)
-
-       lwz     r0, 4(r7)               /* int_return ...               */
-       add     r0, r0, r3              /*  ... += dest_addr            */
-       stw     r0, 4(r7)
-
-       blr
-
 #if defined(CONFIG_440)
 /*----------------------------------------------------------------------------+
 | dcbz_area.
index 0019d460902c107a361cf059e634234999bfc976..fa5c5f66c1c257fae223ce5b871fbca4a022031b 100644 (file)
  * 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__ */
index 60a76253b268a34bfa236e2198e66c93ac3d6130..334e457805cfba49a6847be06c81ed18ca9bba96 100644 (file)
@@ -28,6 +28,7 @@ LIB   = $(obj)lib$(ARCH).a
 SOBJS-y        += ppccache.o
 SOBJS-y        += ppcstring.o
 SOBJS-y        += ticks.o
+SOBJS-y        += reloc.o
 
 COBJS-y        += bat_rw.o
 COBJS-y        += board.o
diff --git a/lib_ppc/reloc.S b/lib_ppc/reloc.S
new file mode 100644 (file)
index 0000000..50f9a83
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 Wolfgang Denk <wd@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <ppc_asm.tmpl>
+
+       .file   "reloc.S"
+
+       .text
+#ifndef CONFIG_NAND_SPL
+       /*
+        * Function: relocate entries for one exception vector
+        */
+       .globl trap_reloc
+       .type   trap_reloc, @function
+trap_reloc:
+       lwz     r0, 0(r7)               /* hdlr ...             */
+       add     r0, r0, r3              /*  ... += dest_addr    */
+       stw     r0, 0(r7)
+
+       lwz     r0, 4(r7)               /* int_return ...       */
+       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
+       .size   trap_reloc, .-trap_reloc
+#endif