Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/ibm4xx Fix broken stack. The r1 is stack p...



details:   https://anonhg.NetBSD.org/src/rev/e5cff53d73e5
branches:  trunk
changeset: 764729:e5cff53d73e5
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Mon May 02 06:37:47 2011 +0000

description:
Fix broken stack.  The r1 is stack pointer.  Not cpu_info pointer.

diffstat:

 sys/arch/powerpc/ibm4xx/trap_subr.S |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 1d1c15b7dc31 -r e5cff53d73e5 sys/arch/powerpc/ibm4xx/trap_subr.S
--- a/sys/arch/powerpc/ibm4xx/trap_subr.S       Mon May 02 06:33:16 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/trap_subr.S       Mon May 02 06:37:47 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap_subr.S,v 1.13 2011/01/18 01:02:54 matt Exp $      */
+/*     $NetBSD: trap_subr.S,v 1.14 2011/05/02 06:37:47 kiyohara Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -90,14 +90,15 @@
        mfsrr0  %r30;                                           \
        mfsrr1  %r31; /* Test whether we already had PR set */  \
        stmw    %r30,(savearea+CPUSAVE_SRR0)(%r1); /* save srr0/srr1 */ \
+       mfsprg1 %r1;                    /* restore SP */        \
        mtcr    %r31;                                           \
        bc      %cr4,MSR_PR,1f; /* branch if MSR[PR] is clear */        \
-       lwz     %r1,CI_CURPCB(%r1);                             \
+       GET_PCB(%r1);                                           \
        addi    %r1,%r1,USPACE-CALLFRAMELEN; /* stack is top of user struct */ \
 1:
 
 #define        ACCESS_PROLOG(savearea)                                 \
-       mtsprg1 %r1;                    /* save SP */           \
+       mtsprg1 %r1;                    /* save SP temporalily */       \
        GET_CPUINFO(%r1);                                       \
        stmw    %r28,(savearea+CPUSAVE_R28)(%r1); /* free r28-r31 */    \
        mflr    %r28;                   /* save LR */           \
@@ -108,24 +109,26 @@
        mfsrr0  %r30;                                           \
        mfsrr1  %r31; /* Test whether we already had PR set */  \
        stmw    %r30,(savearea+CPUSAVE_SRR0)(%r1); /* save srr0/srr1 */ \
+       mfsprg1 %r1;                    /* restore SP */        \
        mtcr    %r31;                                           \
        bc      %cr4,MSR_PR,1f; /* branch if MSR[PR] is clear */        \
-       lwz     %r1,CI_CURPCB(%r1);                             \
+       GET_PCB(%r1);                                           \
        addi    %r1,%r1,USPACE-CALLFRAMELEN; /* stack is top of user struct */ \
 1:
 
 #define        CRITICAL_PROLOG(savearea)                               \
        mtsprg1 %r1;                    /* save SP */           \
-       GET_CPUINFO(%r2);                                       \
+       GET_CPUINFO(%r1);                                       \
        stmw    %r28,(savearea+CPUSAVE_R28)(%r1); /* free r28-r31 */    \
        mflr    %r28;                   /* save LR */           \
        mfcr    %r29;                   /* save CR */           \
        mfsrr2  %r30; /* Fake a standard trap */                \
        mfsrr3  %r31; /* Test whether we already had PR set */  \
        stmw    %r30,(savearea+CPUSAVE_SRR0)(%r1); /* save srr0/srr1 */ \
+       mfsprg1 %r1;                    /* restore SP */        \
        mtcr    %r31;                                           \
        bc      %cr4,MSR_PR,1f; /* branch if MSR[PR] is clear */        \
-       lwz     %r1,CI_CURPCB(%r1);                             \
+       GET_PCB(%r1);                                           \
        addi    %r1,%r1,USPACE-CALLFRAMELEN; /* stack is top of user struct */ \
 1:
 



Home | Main Index | Thread Index | Old Index