]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/mpc5xx/start.S
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / cpu / mpc5xx / start.S
index 85ea7a88276631cc9ced7d3e699a9fece98e127d..0af879e39130577fa757ab065f0acd28f327f472 100644 (file)
@@ -56,7 +56,7 @@
 /*
  * Set up GOT: Global Offset Table
  *
- * Use r14 to access the GOT
+ * Use r12 to access the GOT
  */
        START_GOT
        GOT_ENTRY(_GOT2_TABLE_)
@@ -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.
        */
@@ -385,6 +372,7 @@ relocate_code:
        mr      r9,  r4         /* Save copy of global data pointer in SRAM */
        mr      r10, r5         /* Save copy of monitor destination Address in SRAM */
 
+       GET_GOT
        mr      r3,  r5                         /* Destination Address  */
        lis     r4, CONFIG_SYS_MONITOR_BASE@h           /* Source      Address  */
        ori     r4, r4, CONFIG_SYS_MONITOR_BASE@l
@@ -401,7 +389,7 @@ relocate_code:
        sub     r15, r10, r4
 
        /* First our own GOT */
-       add     r14, r14, r15
+       add     r12, r12, r15
        /* the the one used by the C code */
        add     r30, r30, r15
 
@@ -446,7 +434,7 @@ relocate_code:
 in_ram:
 
        /*
-        * Relocation Function, r14 point to got2+0x8000
+        * Relocation Function, r12 point to got2+0x8000
         *
         * Adjust got2 pointers, no need to check for 0, this code
         * already puts a few entries in the table.
@@ -510,6 +498,8 @@ clear_bss:
         */
        .globl  trap_init
 trap_init:
+       mflr    r4                      /* save link register           */
+       GET_GOT
        lwz     r7, GOT(_start)
        lwz     r8, GOT(_end_of_vectors)
 
@@ -517,8 +507,6 @@ trap_init:
 
        cmplw   0, r7, r8
        bgelr                           /* return if r7>=r8 - just in case */
-
-       mflr    r4                      /* save link register           */
 1:
        lwz     r0, 0(r7)
        stw     r0, 0(r9)
@@ -563,24 +551,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: