]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/74xx_7xx/start.S
* Patch by Hans-Joerg Frieden, 06 Dec 2002
[karo-tx-uboot.git] / cpu / 74xx_7xx / start.S
index fe08f8e8379df5657872f59f2437ab0217ffced6..0d63144356f01d130da131f362e4f08c767f4929 100644 (file)
@@ -177,7 +177,14 @@ SystemCall:
        add     r11,r11,r0
        lwz     r11,0(r11)
 
-       li      r12,0xd00-4*3           /* save LR & SRRx */
+       li      r20,0xd00-4             /* Get stack pointer */
+       lwz     r12,0(r20)
+       subi    r12,r12,12              /* Adjust stack pointer */
+       li      r0,0xc00+_end_back-SystemCall
+       cmplw   0, r0, r12              /* Check stack overflow */
+       bgt     1f
+       stw     r12,0(r20)
+
        mflr    r0
        stw     r0,0(r12)
        mfspr   r0,SRR0
@@ -202,7 +209,9 @@ _back:
        mtmsr   r11
        SYNC
 
-       li      r12,0xd00-4*3           /* restore regs */
+       li      r12,0xd00-4             /* restore regs */
+       lwz     r12,0(r12)
+
        lwz     r11,0(r12)
        mtlr    r11
        lwz     r11,4(r12)
@@ -210,8 +219,13 @@ _back:
        lwz     r11,8(r12)
        mtspr   SRR1,r11
 
+       addi    r12,r12,12              /* Adjust stack pointer */
+       li      r20,0xd00-4
+       stw     r12,0(r20)
+
        SYNC
        rfi
+_end_back:
 
        STD_EXCEPTION(0xd00, SingleStep, UnknownException)
 
@@ -716,6 +730,9 @@ in_ram:
        bne     5b
 6:
        mr      r3, r10         /* Destination Address          */
+#ifdef CONFIG_AMIGAONEG3SE
+       mr      r4, r9          /* Use RAM copy of the global data */
+#endif
        bl      after_reloc
 
        /* not reached - end relocate_code */