From: Michal Simek Date: Tue, 22 Jun 2010 15:58:26 +0000 (+0200) Subject: microblaze: Move SAVE_STATE upward X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e5d2af2b96696420865a1644c94a0e79e34c6035;p=linux-beck.git microblaze: Move SAVE_STATE upward SAVE_STATE macro could be used by other rutines too. Signed-off-by: Michal Simek --- diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 16cb4f1d2338..cf4a0aa35c0e 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 */