linux-mips-fnet
[Top] [All Lists]

Re: Help! got stuck on the DS2100/3100

To: linux-mips@fnet.fr
Subject: Re: Help! got stuck on the DS2100/3100
From: Ralf Baechle <ralf@informatik.uni-koblenz.de>
Date: Sun, 31 Aug 1997 05:16:10 +0200 (MET DST)
In-reply-to: <Pine.LNX.3.91.970830230439.14318A-100000@lehr.chem.tu-berlin.de> from "Frieder Streffer" at Aug 30, 97 11:16:16 pm
> 
> Hi Ralf,
> I just put in two nop instructions, so I donst send you a full patch!
> The file is include/asm/stackframe.h of the 2.1.14 kernel
> 
> was:
> #define SAVE_ALL
>                 mfc0 k0, CP0_STATUS; \
>                 sll  k0, 3; \
> 
> now is:
> #define SAVE_ALL
>                 mfc0 k0, CP0_STATUS; \
>                 nop; \
>                 sll  k0, 3; \
> 
> was:
> #define RESTORE_ALL
>                 mfc0 t0, CP0_STATUS; \
>                 ori  t0, 0x1f; \
> 
> now is:
> #define RESTORE_ALL
>                 mfc0 t0, CP0_STATUS; \
>                 nop; \
>                 ori  t0, 0x1f; \
> 
> A little bit simplistic, and there is surely a better solution but this 

Well, here is my solution.  The assembler knows about a lot of the
pipeline hazards, so I just leave the job to the assembler.  All
it takes is allowing instruction scheduling by .set reorder.

Index: include/asm-mips/stackframe.h
===================================================================
RCS file: /usr/src/cvs/linux/include/asm-mips/stackframe.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stackframe.h
--- stackframe.h        1997/06/01 03:17:13     1.1.1.1
+++ stackframe.h        1997/08/31 03:07:59
@@ -10,8 +10,11 @@
 #include <asm/offset.h>
 
 #define SAVE_ALL                                         \
+               .set    push;                            \
+               .set    reorder;                         \
                mfc0    k0, CP0_STATUS;                  \
                sll     k0, 3;     /* extract cu0 bit */ \
+               .set    pop;                             \
                bltz    k0, 8f;                          \
                 move   k1, sp;                          \
                /* Called from user mode, new stack. */  \
@@ -68,7 +71,10 @@
  * that a modified IE mask will be nullified.
  */
 #define RESTORE_ALL                                      \
+               .set    push;                            \
+               .set    reorder;                         \
                mfc0    t0, CP0_STATUS;                  \
+               .set    pop;                             \
                ori     t0, 0x1f;                        \
                xori    t0, 0x1f;                        \
                mtc0    t0, CP0_STATUS;                  \


> has done the job on my machines.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>