X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=cpu%2Fmpc512x%2Fstart.S;h=d26b61707e07057c8d82c74af0579b3150d10490;hb=8f5407c90d3738c3a3c4caca442bc8441cc76f6d;hp=360682dafcfdcb471a23bcdb2749ee65b5959872;hpb=be4880ebe4355e8782be4af4b337a1b98dffcbe3;p=karo-tx-uboot.git diff --git a/cpu/mpc512x/start.S b/cpu/mpc512x/start.S index 360682dafc..d26b61707e 100644 --- a/cpu/mpc512x/start.S +++ b/cpu/mpc512x/start.S @@ -1,8 +1,8 @@ /* * Copyright (C) 1998 Dan Malek * Copyright (C) 1999 Magnus Damm - * Copyright (C) 2000, 2001, 2002, 2007 Wolfgang Denk - * Copyright Freescale Semiconductor, Inc. 2004, 2006. All rights reserved. + * Copyright (C) 2000-2009 Wolfgang Denk + * Copyright Freescale Semiconductor, Inc. 2004, 2006. * * See file CREDITS for list of people who contributed to this * project. @@ -30,12 +30,14 @@ */ #include -#include #include #include #define CONFIG_521X 1 /* needed for Linux kernel header files*/ +#include +#include "asm-offsets.h" + #include #include @@ -63,7 +65,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_) @@ -125,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) @@ -499,6 +486,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -517,7 +505,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -597,7 +585,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. @@ -609,15 +597,17 @@ in_ram: sub r11,r3,r11 addi r3,r3,-4 1: lwzu r0,4(r3) + cmpwi r0,0 + beq- 2f add r0,r0,r11 stw r0,0(r3) - bdnz 1b +2: bdnz 1b /* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 @@ -659,6 +649,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) @@ -666,8 +658,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) @@ -719,17 +709,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