]> git.karo-electronics.de Git - linux-beck.git/commitdiff
microblaze: Move SAVE_STATE upward
authorMichal Simek <monstr@monstr.eu>
Tue, 22 Jun 2010 15:58:26 +0000 (17:58 +0200)
committerMichal Simek <monstr@monstr.eu>
Wed, 4 Aug 2010 08:31:09 +0000 (10:31 +0200)
SAVE_STATE macro could be used by other rutines too.

Signed-off-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/kernel/entry.S

index 16cb4f1d23387712d895e3459c96f376ffb1f3d0..cf4a0aa35c0ee7073e5ed0a41b4863ca3ea2fca9 100644 (file)
        lwi     r30, r1, PTO+PT_R30;                                    \
        lwi     r31, r1, PTO+PT_R31;    /* Restore cur task reg */
 
+#define SAVE_STATE     \
+       swi     r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */     \
+       /* See if already in kernel mode.*/                             \
+       mfs     r1, rmsr;                                               \
+       nop;                                                            \
+       andi    r1, r1, MSR_UMS;                                        \
+       bnei    r1, 1f;                                         \
+       /* Kernel-mode state save.  */                                  \
+       /* Reload kernel stack-ptr. */                                  \
+       lwi     r1, r0, TOPHYS(PER_CPU(ENTRY_SP));                      \
+       tophys(r1,r1);                                                  \
+       addik   r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack.  */\
+       SAVE_REGS                                                       \
+       swi     r1, r1, PTO+PT_MODE;                                    \
+       brid    2f;                                                     \
+       nop;                            /* Fill delay slot */           \
+1:     /* User-mode state save.  */                                    \
+       lwi     r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
+       tophys(r1,r1);                                                  \
+       lwi     r1, r1, TS_THREAD_INFO; /* get the thread info */       \
+       addik   r1, r1, THREAD_SIZE;    /* calculate kernel stack pointer */\
+       tophys(r1,r1);                                                  \
+       addik   r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack.  */\
+       SAVE_REGS                                                       \
+       swi     r0, r1, PTO + PT_MODE; /* Was in user-mode.  */         \
+       lwi     r11, r0, TOPHYS(PER_CPU(ENTRY_SP));                     \
+       swi     r11, r1, PTO+PT_R1; /* Store user SP.  */               \
+       /* MS: I am clearing UMS even in case when I come from kernel space */ \
+       clear_ums;                                                      \
+2:     lwi     CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
+
 .text
 
 /*
@@ -511,38 +542,6 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
 /*
  * HW EXCEPTION rutine start
  */
-
-#define SAVE_STATE     \
-       swi     r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */     \
-       /* See if already in kernel mode.*/                             \
-       mfs     r1, rmsr;                                               \
-       nop;                                                            \
-       andi    r1, r1, MSR_UMS;                                        \
-       bnei    r1, 1f;                                         \
-       /* Kernel-mode state save.  */                                  \
-       /* Reload kernel stack-ptr. */                                  \
-       lwi     r1, r0, TOPHYS(PER_CPU(ENTRY_SP));                      \
-       tophys(r1,r1);                                                  \
-       addik   r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack.  */\
-       SAVE_REGS                                                       \
-       swi     r1, r1, PTO+PT_MODE;                                    \
-       brid    2f;                                                     \
-       nop;                            /* Fill delay slot */           \
-1:     /* User-mode state save.  */                                    \
-       lwi     r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
-       tophys(r1,r1);                                                  \
-       lwi     r1, r1, TS_THREAD_INFO; /* get the thread info */       \
-       addik   r1, r1, THREAD_SIZE;    /* calculate kernel stack pointer */\
-       tophys(r1,r1);                                                  \
-       addik   r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack.  */\
-       SAVE_REGS                                                       \
-       swi     r0, r1, PTO + PT_MODE; /* Was in user-mode.  */         \
-       lwi     r11, r0, TOPHYS(PER_CPU(ENTRY_SP));                     \
-       swi     r11, r1, PTO+PT_R1; /* Store user SP.  */               \
-       /* MS: I am clearing UMS even in case when I come from kernel space */ \
-       clear_ums;                                                      \
-2:     lwi     CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
-
 C_ENTRY(full_exception_trap):
        /* adjust exception address for privileged instruction
         * for finding where is it */