aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/entry.S
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-06-22 10:39:56 -0400
committerMichal Simek <monstr@monstr.eu>2010-08-04 04:22:53 -0400
commit77f6d226050e2d8f046e268a9f84ec834172f0de (patch)
tree1f4f80974504eebab50d231d438ae61fb48f4afc /arch/microblaze/kernel/entry.S
parent06a54604a31f06715a393a4fdd099b03611cce10 (diff)
microblaze: Remove additional setup for kernel_mode
PT_MODE stores information if kernel comes from user or kernel space. If come from user space, PT_MODE contains 0. If come from kernel store, PT_MODE contains non zero value. We don't need to save value 1. I am using r1 register which contains non zero value. This change save one additional instruction. Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel/entry.S')
-rw-r--r--arch/microblaze/kernel/entry.S25
1 files changed, 10 insertions, 15 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index aa611cd35042..5318ad375fec 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -286,8 +286,7 @@ C_ENTRY(_user_exception):
286 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 286 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
287 SAVE_REGS 287 SAVE_REGS
288 288
289 addi r11, r0, 1; /* Was in kernel-mode. */ 289 swi r1, r1, PTO + PT_MODE; /* pt_regs -> kernel mode */
290 swi r11, r1, PTO+PT_MODE; /* pt_regs -> kernel mode */
291 brid 2f; 290 brid 2f;
292 nop; /* Fill delay slot */ 291 nop; /* Fill delay slot */
293 292
@@ -303,7 +302,7 @@ C_ENTRY(_user_exception):
303 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 302 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
304 SAVE_REGS 303 SAVE_REGS
305 304
306 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 305 swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */
307 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 306 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
308 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 307 swi r11, r1, PTO+PT_R1; /* Store user SP. */
3092: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 3082: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
@@ -380,7 +379,7 @@ C_ENTRY(ret_from_trap):
380 swi r3, r1, PTO + PT_R3 379 swi r3, r1, PTO + PT_R3
381 swi r4, r1, PTO + PT_R4 380 swi r4, r1, PTO + PT_R4
382 381
383 lwi r11, r1, PTO+PT_MODE; 382 lwi r11, r1, PTO + PT_MODE;
384/* See if returning to kernel mode, if so, skip resched &c. */ 383/* See if returning to kernel mode, if so, skip resched &c. */
385 bnei r11, 2f; 384 bnei r11, 2f;
386 /* We're returning to user mode, so check for various conditions that 385 /* We're returning to user mode, so check for various conditions that
@@ -513,8 +512,7 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
513 tophys(r1,r1); \ 512 tophys(r1,r1); \
514 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ 513 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
515 SAVE_REGS \ 514 SAVE_REGS \
516 addi r11, r0, 1; /* Was in kernel-mode. */ \ 515 swi r1, r1, PTO+PT_MODE; \
517 swi r11, r1, PTO+PT_MODE; \
518 brid 2f; \ 516 brid 2f; \
519 nop; /* Fill delay slot */ \ 517 nop; /* Fill delay slot */ \
5201: /* User-mode state save. */ \ 5181: /* User-mode state save. */ \
@@ -525,7 +523,7 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
525 tophys(r1,r1); \ 523 tophys(r1,r1); \
526 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ 524 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
527 SAVE_REGS \ 525 SAVE_REGS \
528 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \ 526 swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \
529 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 527 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
530 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ 528 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
5312: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 5292: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
@@ -645,7 +643,7 @@ C_ENTRY(page_fault_instr_trap):
645 643
646/* Entry point used to return from an exception. */ 644/* Entry point used to return from an exception. */
647C_ENTRY(ret_from_exc): 645C_ENTRY(ret_from_exc):
648 lwi r11, r1, PTO+PT_MODE; 646 lwi r11, r1, PTO + PT_MODE;
649 bnei r11, 2f; /* See if returning to kernel mode, */ 647 bnei r11, 2f; /* See if returning to kernel mode, */
650 /* ... if so, skip resched &c. */ 648 /* ... if so, skip resched &c. */
651 649
@@ -733,9 +731,7 @@ C_ENTRY(_interrupt):
733/* MS: Make room on the stack -> activation record */ 731/* MS: Make room on the stack -> activation record */
734 addik r1, r1, -STATE_SAVE_SIZE; 732 addik r1, r1, -STATE_SAVE_SIZE;
735 SAVE_REGS 733 SAVE_REGS
736 /* MS: store mode */ 734 swi r1, r1, PTO + PT_MODE; /* 0 - user mode, 1 - kernel mode */
737 addi r11, r0, 1; /* MS: Was in kernel-mode. */
738 swi r11, r1, PTO + PT_MODE; /* MS: and save it */
739 brid 2f; 735 brid 2f;
740 nop; /* MS: Fill delay slot */ 736 nop; /* MS: Fill delay slot */
741 737
@@ -852,8 +848,7 @@ C_ENTRY(_debug_exception):
852 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 848 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
853 SAVE_REGS; 849 SAVE_REGS;
854 850
855 addi r11, r0, 1; /* Was in kernel-mode. */ 851 swi r1, r1, PTO + PT_MODE;
856 swi r11, r1, PTO + PT_MODE;
857 brid 2f; 852 brid 2f;
858 nop; /* Fill delay slot */ 853 nop; /* Fill delay slot */
8591: /* User-mode state save. */ 8541: /* User-mode state save. */
@@ -866,7 +861,7 @@ C_ENTRY(_debug_exception):
866 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 861 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
867 SAVE_REGS; 862 SAVE_REGS;
868 863
869 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 864 swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */
870 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 865 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
871 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 866 swi r11, r1, PTO+PT_R1; /* Store user SP. */
8722: 8672:
@@ -880,7 +875,7 @@ dbtrap_call: rtbd r0, send_sig;
880 addik r15, r0, dbtrap_call; 875 addik r15, r0, dbtrap_call;
881 876
882 set_bip; /* Ints masked for state restore*/ 877 set_bip; /* Ints masked for state restore*/
883 lwi r11, r1, PTO+PT_MODE; 878 lwi r11, r1, PTO + PT_MODE;
884 bnei r11, 2f; 879 bnei r11, 2f;
885 880
886 /* Get current task ptr into r11 */ 881 /* Get current task ptr into r11 */