diff options
author | Michal Simek <monstr@monstr.eu> | 2010-06-22 17:58:26 +0200 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-08-04 10:31:09 +0200 |
commit | e5d2af2b96696420865a1644c94a0e79e34c6035 (patch) | |
tree | 35ca8c70ab61f1f09b1099fd71bf152aad256df2 /arch/microblaze/kernel | |
parent | 66f7de8634b39fb685556419fc12522e96990d32 (diff) |
microblaze: Move SAVE_STATE upward
SAVE_STATE macro could be used by other rutines too.
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r-- | arch/microblaze/kernel/entry.S | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 16cb4f1d233..cf4a0aa35c0 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S @@ -269,6 +269,37 @@ 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 */ |