aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r--arch/microblaze/kernel/entry.S43
1 files changed, 20 insertions, 23 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index f5fe220954b0..9a98f70e4c30 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -275,9 +275,12 @@ C_ENTRY(_user_exception):
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 */ 276 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */
277 277
278 lwi r11, r0, TOPHYS(PER_CPU(KM));/* See if already in kernel mode.*/ 278 mfs r11, rmsr
279 beqi r11, 1f; /* Jump ahead if coming from user */ 279 nop
280/* Kernel-mode state save. */ 280 andi r11, r11, MSR_UMS
281 bnei r11, 1f
282
283/* Kernel-mode state save - kernel execve */
281 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 284 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
282 tophys(r1,r11); 285 tophys(r1,r11);
283 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */ 286 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */
@@ -307,8 +310,6 @@ C_ENTRY(_user_exception):
307 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 310 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
308 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 311 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
309 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 312 swi r11, r1, PTO+PT_R1; /* Store user SP. */
310 addi r11, r0, 1;
311 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
3122: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 3132: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
313 /* Save away the syscall number. */ 314 /* Save away the syscall number. */
314 swi r12, r1, PTO+PT_R0; 315 swi r12, r1, PTO+PT_R0;
@@ -423,7 +424,6 @@ C_ENTRY(ret_from_trap):
423 424
424/* Finally, return to user state. */ 425/* Finally, return to user state. */
4251: 4261:
426 swi r0, r0, PER_CPU(KM); /* Now officially in user state. */
427 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 427 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
428 VM_OFF; 428 VM_OFF;
429 tophys(r1,r1); 429 tophys(r1,r1);
@@ -511,8 +511,10 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
511 enable_irq; \ 511 enable_irq; \
512 set_ee; \ 512 set_ee; \
513 /* See if already in kernel mode.*/ \ 513 /* See if already in kernel mode.*/ \
514 lwi r11, r0, TOPHYS(PER_CPU(KM)); \ 514 mfs r11, rmsr; \
515 beqi r11, 1f; /* Jump ahead if coming from user */\ 515 nop; \
516 andi r11, r11, MSR_UMS; \
517 bnei r11, 1f; \
516 /* Kernel-mode state save. */ \ 518 /* Kernel-mode state save. */ \
517 /* Reload kernel stack-ptr. */ \ 519 /* Reload kernel stack-ptr. */ \
518 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 520 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
@@ -544,8 +546,6 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
544 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \ 546 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \
545 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 547 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
546 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ 548 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
547 addi r11, r0, 1; \
548 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode.*/\
5492: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \ 5492: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \
550 /* Save away the syscall number. */ \ 550 /* Save away the syscall number. */ \
551 swi r0, r1, PTO+PT_R0; \ 551 swi r0, r1, PTO+PT_R0; \
@@ -686,7 +686,7 @@ C_ENTRY(ret_from_exc):
686 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 686 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
687 687
688/* Finally, return to user state. */ 688/* Finally, return to user state. */
6891: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */ 6891:
690 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 690 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
691 VM_OFF; 691 VM_OFF;
692 tophys(r1,r1); 692 tophys(r1,r1);
@@ -724,8 +724,10 @@ C_ENTRY(_interrupt):
724 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 724 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
725 swi r11, r0, TOPHYS(PER_CPU(R11_SAVE)); 725 swi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
726 /* MS: See if already in kernel mode. */ 726 /* MS: See if already in kernel mode. */
727 lwi r11, r0, TOPHYS(PER_CPU(KM)); 727 mfs r11, rmsr
728 beqi r11, 1f; /* MS: Jump ahead if coming from user */ 728 nop
729 andi r11, r11, MSR_UMS
730 bnei r11, 1f
729 731
730/* Kernel-mode state save. */ 732/* Kernel-mode state save. */
731 or r11, r1, r0 733 or r11, r1, r0
@@ -761,10 +763,6 @@ C_ENTRY(_interrupt):
761 swi r0, r1, PTO + PT_MODE; 763 swi r0, r1, PTO + PT_MODE;
762 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 764 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
763 swi r11, r1, PTO+PT_R1; 765 swi r11, r1, PTO+PT_R1;
764 /* setup kernel mode to KM */
765 addi r11, r0, 1;
766 swi r11, r0, TOPHYS(PER_CPU(KM));
767
7682: 7662:
769 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 767 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
770 swi r0, r1, PTO + PT_R0; 768 swi r0, r1, PTO + PT_R0;
@@ -803,7 +801,6 @@ ret_from_irq:
803no_intr_resched: 801no_intr_resched:
804 /* Disable interrupts, we are now committed to the state restore */ 802 /* Disable interrupts, we are now committed to the state restore */
805 disable_irq 803 disable_irq
806 swi r0, r0, PER_CPU(KM); /* MS: Now officially in user state. */
807 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); 804 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
808 VM_OFF; 805 VM_OFF;
809 tophys(r1,r1); 806 tophys(r1,r1);
@@ -858,8 +855,10 @@ C_ENTRY(_debug_exception):
858 set_bip; /*equalize initial state for all possible entries*/ 855 set_bip; /*equalize initial state for all possible entries*/
859 clear_eip; 856 clear_eip;
860 enable_irq; 857 enable_irq;
861 lwi r11, r0, TOPHYS(PER_CPU(KM));/* See if already in kernel mode.*/ 858 mfs r11, rmsr
862 beqi r11, 1f; /* Jump ahead if coming from user */ 859 nop
860 andi r11, r11, MSR_UMS
861 bnei r11, 1f
863 /* Kernel-mode state save. */ 862 /* Kernel-mode state save. */
864 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 863 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
865 tophys(r1,r11); 864 tophys(r1,r11);
@@ -887,8 +886,6 @@ C_ENTRY(_debug_exception):
887 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 886 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
888 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 887 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
889 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 888 swi r11, r1, PTO+PT_R1; /* Store user SP. */
890 addi r11, r0, 1;
891 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
8922: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 8892: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
893 /* Save away the syscall number. */ 890 /* Save away the syscall number. */
894 swi r0, r1, PTO+PT_R0; 891 swi r0, r1, PTO+PT_R0;
@@ -944,7 +941,7 @@ dbtrap_call: rtbd r11, 0;
944 941
945 942
946/* Finally, return to user state. */ 943/* Finally, return to user state. */
9471: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */ 9441:
948 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 945 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
949 VM_OFF; 946 VM_OFF;
950 tophys(r1,r1); 947 tophys(r1,r1);