aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/entry.S
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-06-22 08:51:45 -0400
committerMichal Simek <monstr@monstr.eu>2010-08-04 04:22:50 -0400
commit653e447e113a19fcb54d454b9f5a3bff9979729f (patch)
tree8b0fa9048ca38a547069496e7265769d77ca4d44 /arch/microblaze/kernel/entry.S
parent0388107dd50eaa52c028312a7cc20177cb95a943 (diff)
microblaze: Completely remove working with R11 register
We don't need to save R11 register. There is easy way to use only R1 which is saved and restore later. Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel/entry.S')
-rw-r--r--arch/microblaze/kernel/entry.S62
1 files changed, 21 insertions, 41 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index 1f4028049449..9b8e072d828d 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -273,18 +273,15 @@
273C_ENTRY(_user_exception): 273C_ENTRY(_user_exception):
274 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ 274 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
275 addi r14, r14, 4 /* return address is 4 byte after call */ 275 addi r14, r14, 4 /* return address is 4 byte after call */
276 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */
277 276
278 mfs r11, rmsr 277 mfs r1, rmsr
279 nop 278 nop
280 andi r11, r11, MSR_UMS 279 andi r1, r1, MSR_UMS
281 bnei r11, 1f 280 bnei r1, 1f
282 281
283/* Kernel-mode state save - kernel execve */ 282/* Kernel-mode state save - kernel execve */
284 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 283 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
285 tophys(r1,r11); 284 tophys(r1,r1);
286 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */
287 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
288 285
289 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 286 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
290 SAVE_REGS 287 SAVE_REGS
@@ -296,7 +293,6 @@ C_ENTRY(_user_exception):
296 293
297/* User-mode state save. */ 294/* User-mode state save. */
2981: 2951:
299 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
300 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 296 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
301 tophys(r1,r1); 297 tophys(r1,r1);
302 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ 298 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */
@@ -506,18 +502,15 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
506 502
507#define SAVE_STATE \ 503#define SAVE_STATE \
508 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ 504 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \
509 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */ \
510 /* See if already in kernel mode.*/ \ 505 /* See if already in kernel mode.*/ \
511 mfs r11, rmsr; \ 506 mfs r1, rmsr; \
512 nop; \ 507 nop; \
513 andi r11, r11, MSR_UMS; \ 508 andi r1, r1, MSR_UMS; \
514 bnei r11, 1f; \ 509 bnei r1, 1f; \
515 /* Kernel-mode state save. */ \ 510 /* Kernel-mode state save. */ \
516 /* Reload kernel stack-ptr. */ \ 511 /* Reload kernel stack-ptr. */ \
517 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 512 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
518 tophys(r1,r11); \ 513 tophys(r1,r1); \
519 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */ \
520 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */\
521 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ 514 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
522 SAVE_REGS \ 515 SAVE_REGS \
523 /* PC, before IRQ/trap - this is one instruction above */ \ 516 /* PC, before IRQ/trap - this is one instruction above */ \
@@ -528,13 +521,11 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
528 brid 2f; \ 521 brid 2f; \
529 nop; /* Fill delay slot */ \ 522 nop; /* Fill delay slot */ \
5301: /* User-mode state save. */ \ 5231: /* User-mode state save. */ \
531 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */\
532 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ 524 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
533 tophys(r1,r1); \ 525 tophys(r1,r1); \
534 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \ 526 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \
535 addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */\ 527 addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */\
536 tophys(r1,r1); \ 528 tophys(r1,r1); \
537 \
538 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ 529 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
539 SAVE_REGS \ 530 SAVE_REGS \
540 /* PC, before IRQ/trap - this is one instruction above FIXME*/ \ 531 /* PC, before IRQ/trap - this is one instruction above FIXME*/ \
@@ -726,20 +717,15 @@ C_ENTRY(_interrupt):
726/* MS: we are in physical address */ 717/* MS: we are in physical address */
727/* Save registers, switch to proper stack, convert SP to virtual.*/ 718/* Save registers, switch to proper stack, convert SP to virtual.*/
728 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 719 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
729 swi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
730 /* MS: See if already in kernel mode. */ 720 /* MS: See if already in kernel mode. */
731 mfs r11, rmsr 721 mfs r1, rmsr
732 nop 722 nop
733 andi r11, r11, MSR_UMS 723 andi r1, r1, MSR_UMS
734 bnei r11, 1f 724 bnei r1, 1f
735 725
736/* Kernel-mode state save. */ 726/* Kernel-mode state save. */
737 or r11, r1, r0 727 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
738 tophys(r1,r11); /* MS: I have in r1 physical address where stack is */ 728 tophys(r1,r1); /* MS: I have in r1 physical address where stack is */
739/* MS: Save original SP - position PT_R1 to next stack frame 4 *1 - 152*/
740 swi r11, r1, (PT_R1 - PT_SIZE);
741/* MS: restore r11 because of saving in SAVE_REGS */
742 lwi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
743 /* save registers */ 729 /* save registers */
744/* MS: Make room on the stack -> activation record */ 730/* MS: Make room on the stack -> activation record */
745 addik r1, r1, -STATE_SAVE_SIZE; 731 addik r1, r1, -STATE_SAVE_SIZE;
@@ -752,8 +738,6 @@ C_ENTRY(_interrupt):
752 738
7531: 7391:
754/* User-mode state save. */ 740/* User-mode state save. */
755/* MS: restore r11 -> FIXME move before SAVE_REG */
756 lwi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
757 /* MS: get the saved current */ 741 /* MS: get the saved current */
758 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 742 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
759 tophys(r1,r1); 743 tophys(r1,r1);
@@ -855,16 +839,13 @@ C_ENTRY(_debug_exception):
855 /* BIP bit is set on entry, no interrupts can occur */ 839 /* BIP bit is set on entry, no interrupts can occur */
856 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 840 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
857 841
858 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */ 842 mfs r1, rmsr
859 mfs r11, rmsr
860 nop 843 nop
861 andi r11, r11, MSR_UMS 844 andi r1, r1, MSR_UMS
862 bnei r11, 1f 845 bnei r1, 1f
863 /* Kernel-mode state save. */ 846 /* Kernel-mode state save. */
864 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 847 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
865 tophys(r1,r11); 848 tophys(r1,r1);
866 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */
867 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
868 849
869 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 850 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
870 SAVE_REGS; 851 SAVE_REGS;
@@ -874,7 +855,6 @@ C_ENTRY(_debug_exception):
874 brid 2f; 855 brid 2f;
875 nop; /* Fill delay slot */ 856 nop; /* Fill delay slot */
8761: /* User-mode state save. */ 8571: /* User-mode state save. */
877 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
878 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 858 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
879 tophys(r1,r1); 859 tophys(r1,r1);
880 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ 860 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */
@@ -887,7 +867,7 @@ C_ENTRY(_debug_exception):
887 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 867 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
888 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 868 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
889 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 869 swi r11, r1, PTO+PT_R1; /* Store user SP. */
8902: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 8702:
891 /* Save away the syscall number. */ 871 /* Save away the syscall number. */
892 swi r0, r1, PTO+PT_R0; 872 swi r0, r1, PTO+PT_R0;
893 tovirt(r1,r1) 873 tovirt(r1,r1)