diff options
author | Michal Simek <monstr@monstr.eu> | 2010-06-22 11:58:26 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-08-04 04:31:09 -0400 |
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 16cb4f1d2338..cf4a0aa35c0e 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -269,6 +269,37 @@ | |||
269 | lwi r30, r1, PTO+PT_R30; \ | 269 | lwi r30, r1, PTO+PT_R30; \ |
270 | lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */ | 270 | lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */ |
271 | 271 | ||
272 | #define SAVE_STATE \ | ||
273 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ | ||
274 | /* See if already in kernel mode.*/ \ | ||
275 | mfs r1, rmsr; \ | ||
276 | nop; \ | ||
277 | andi r1, r1, MSR_UMS; \ | ||
278 | bnei r1, 1f; \ | ||
279 | /* Kernel-mode state save. */ \ | ||
280 | /* Reload kernel stack-ptr. */ \ | ||
281 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | ||
282 | tophys(r1,r1); \ | ||
283 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | ||
284 | SAVE_REGS \ | ||
285 | swi r1, r1, PTO+PT_MODE; \ | ||
286 | brid 2f; \ | ||
287 | nop; /* Fill delay slot */ \ | ||
288 | 1: /* User-mode state save. */ \ | ||
289 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ | ||
290 | tophys(r1,r1); \ | ||
291 | lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \ | ||
292 | addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */\ | ||
293 | tophys(r1,r1); \ | ||
294 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | ||
295 | SAVE_REGS \ | ||
296 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \ | ||
297 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | ||
298 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ | ||
299 | /* MS: I am clearing UMS even in case when I come from kernel space */ \ | ||
300 | clear_ums; \ | ||
301 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | ||
302 | |||
272 | .text | 303 | .text |
273 | 304 | ||
274 | /* | 305 | /* |
@@ -511,38 +542,6 @@ C_ENTRY(sys_rt_sigreturn_wrapper): | |||
511 | /* | 542 | /* |
512 | * HW EXCEPTION rutine start | 543 | * HW EXCEPTION rutine start |
513 | */ | 544 | */ |
514 | |||
515 | #define SAVE_STATE \ | ||
516 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ | ||
517 | /* See if already in kernel mode.*/ \ | ||
518 | mfs r1, rmsr; \ | ||
519 | nop; \ | ||
520 | andi r1, r1, MSR_UMS; \ | ||
521 | bnei r1, 1f; \ | ||
522 | /* Kernel-mode state save. */ \ | ||
523 | /* Reload kernel stack-ptr. */ \ | ||
524 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | ||
525 | tophys(r1,r1); \ | ||
526 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | ||
527 | SAVE_REGS \ | ||
528 | swi r1, r1, PTO+PT_MODE; \ | ||
529 | brid 2f; \ | ||
530 | nop; /* Fill delay slot */ \ | ||
531 | 1: /* User-mode state save. */ \ | ||
532 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ | ||
533 | tophys(r1,r1); \ | ||
534 | lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \ | ||
535 | addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */\ | ||
536 | tophys(r1,r1); \ | ||
537 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | ||
538 | SAVE_REGS \ | ||
539 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \ | ||
540 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | ||
541 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ | ||
542 | /* MS: I am clearing UMS even in case when I come from kernel space */ \ | ||
543 | clear_ums; \ | ||
544 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | ||
545 | |||
546 | C_ENTRY(full_exception_trap): | 545 | C_ENTRY(full_exception_trap): |
547 | /* adjust exception address for privileged instruction | 546 | /* adjust exception address for privileged instruction |
548 | * for finding where is it */ | 547 | * for finding where is it */ |