1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/sys.h>
19 #include <linux/linkage.h>
20
21 #include <asm/entry.h>
22 #include <asm/current.h>
23 #include <asm/processor.h>
24 #include <asm/exceptions.h>
25 #include <asm/asm-offsets.h>
26 #include <asm/thread_info.h>
27
28 #include <asm/page.h>
29 #include <asm/unistd.h>
30
31 #include <linux/errno.h>
32 #include <asm/signal.h>
33
34 #undef DEBUG
35
36 #ifdef DEBUG
37
38 .section .data
39 .global syscall_debug_table
40 .align 4
41 syscall_debug_table:
42 .space (__NR_syscalls * 4)
43 #endif
44
45 #define C_ENTRY(name) .globl name; .align 4; name
46
47
48
49
50
51
52 #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
53 .macro clear_bip
54 msrclr r0, MSR_BIP
55 .endm
56
57 .macro set_bip
58 msrset r0, MSR_BIP
59 .endm
60
61 .macro clear_eip
62 msrclr r0, MSR_EIP
63 .endm
64
65 .macro set_ee
66 msrset r0, MSR_EE
67 .endm
68
69 .macro disable_irq
70 msrclr r0, MSR_IE
71 .endm
72
73 .macro enable_irq
74 msrset r0, MSR_IE
75 .endm
76
77 .macro set_ums
78 msrset r0, MSR_UMS
79 msrclr r0, MSR_VMS
80 .endm
81
82 .macro set_vms
83 msrclr r0, MSR_UMS
84 msrset r0, MSR_VMS
85 .endm
86
87 .macro clear_ums
88 msrclr r0, MSR_UMS
89 .endm
90
91 .macro clear_vms_ums
92 msrclr r0, MSR_VMS | MSR_UMS
93 .endm
94 #else
95 .macro clear_bip
96 mfs r11, rmsr
97 andi r11, r11, ~MSR_BIP
98 mts rmsr, r11
99 .endm
100
101 .macro set_bip
102 mfs r11, rmsr
103 ori r11, r11, MSR_BIP
104 mts rmsr, r11
105 .endm
106
107 .macro clear_eip
108 mfs r11, rmsr
109 andi r11, r11, ~MSR_EIP
110 mts rmsr, r11
111 .endm
112
113 .macro set_ee
114 mfs r11, rmsr
115 ori r11, r11, MSR_EE
116 mts rmsr, r11
117 .endm
118
119 .macro disable_irq
120 mfs r11, rmsr
121 andi r11, r11, ~MSR_IE
122 mts rmsr, r11
123 .endm
124
125 .macro enable_irq
126 mfs r11, rmsr
127 ori r11, r11, MSR_IE
128 mts rmsr, r11
129 .endm
130
131 .macro set_ums
132 mfs r11, rmsr
133 ori r11, r11, MSR_VMS
134 andni r11, r11, MSR_UMS
135 mts rmsr, r11
136 .endm
137
138 .macro set_vms
139 mfs r11, rmsr
140 ori r11, r11, MSR_VMS
141 andni r11, r11, MSR_UMS
142 mts rmsr, r11
143 .endm
144
145 .macro clear_ums
146 mfs r11, rmsr
147 andni r11, r11, MSR_UMS
148 mts rmsr,r11
149 .endm
150
151 .macro clear_vms_ums
152 mfs r11, rmsr
153 andni r11, r11, (MSR_VMS|MSR_UMS)
154 mts rmsr,r11
155 .endm
156 #endif
157
158
159
160
161
162
163
164 #define VM_ON \
165 set_ums; \
166 rted r0, 2f; \
167 nop; \
168 2:
169
170
171 #define VM_OFF \
172 clear_vms_ums; \
173 rted r0, TOPHYS(1f); \
174 nop; \
175 1:
176
177 #define SAVE_REGS \
178 swi r2, r1, PT_R2; \
179 swi r3, r1, PT_R3; \
180 swi r4, r1, PT_R4; \
181 swi r5, r1, PT_R5; \
182 swi r6, r1, PT_R6; \
183 swi r7, r1, PT_R7; \
184 swi r8, r1, PT_R8; \
185 swi r9, r1, PT_R9; \
186 swi r10, r1, PT_R10; \
187 swi r11, r1, PT_R11; \
188 swi r12, r1, PT_R12; \
189 swi r13, r1, PT_R13; \
190 swi r14, r1, PT_PC; \
191 swi r15, r1, PT_R15; \
192 swi r16, r1, PT_R16; \
193 swi r17, r1, PT_R17; \
194 swi r18, r1, PT_R18; \
195 swi r19, r1, PT_R19; \
196 swi r20, r1, PT_R20; \
197 swi r21, r1, PT_R21; \
198 swi r22, r1, PT_R22; \
199 swi r23, r1, PT_R23; \
200 swi r24, r1, PT_R24; \
201 swi r25, r1, PT_R25; \
202 swi r26, r1, PT_R26; \
203 swi r27, r1, PT_R27; \
204 swi r28, r1, PT_R28; \
205 swi r29, r1, PT_R29; \
206 swi r30, r1, PT_R30; \
207 swi r31, r1, PT_R31; \
208 mfs r11, rmsr; \
209 swi r11, r1, PT_MSR;
210
211 #define RESTORE_REGS_GP \
212 lwi r2, r1, PT_R2; \
213 lwi r3, r1, PT_R3; \
214 lwi r4, r1, PT_R4; \
215 lwi r5, r1, PT_R5; \
216 lwi r6, r1, PT_R6; \
217 lwi r7, r1, PT_R7; \
218 lwi r8, r1, PT_R8; \
219 lwi r9, r1, PT_R9; \
220 lwi r10, r1, PT_R10; \
221 lwi r11, r1, PT_R11; \
222 lwi r12, r1, PT_R12; \
223 lwi r13, r1, PT_R13; \
224 lwi r14, r1, PT_PC; \
225 lwi r15, r1, PT_R15; \
226 lwi r16, r1, PT_R16; \
227 lwi r17, r1, PT_R17; \
228 lwi r18, r1, PT_R18; \
229 lwi r19, r1, PT_R19; \
230 lwi r20, r1, PT_R20; \
231 lwi r21, r1, PT_R21; \
232 lwi r22, r1, PT_R22; \
233 lwi r23, r1, PT_R23; \
234 lwi r24, r1, PT_R24; \
235 lwi r25, r1, PT_R25; \
236 lwi r26, r1, PT_R26; \
237 lwi r27, r1, PT_R27; \
238 lwi r28, r1, PT_R28; \
239 lwi r29, r1, PT_R29; \
240 lwi r30, r1, PT_R30; \
241 lwi r31, r1, PT_R31;
242
243 #define RESTORE_REGS \
244 lwi r11, r1, PT_MSR; \
245 mts rmsr , r11; \
246 RESTORE_REGS_GP
247
248 #define RESTORE_REGS_RTBD \
249 lwi r11, r1, PT_MSR; \
250 andni r11, r11, MSR_EIP; \
251 ori r11, r11, MSR_EE | MSR_BIP; \
252 mts rmsr , r11; \
253 RESTORE_REGS_GP
254
255 #define SAVE_STATE \
256 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
257 \
258 mfs r1, rmsr; \
259 andi r1, r1, MSR_UMS; \
260 bnei r1, 1f; \
261 \
262 \
263 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
264 \
265 \
266 \
267 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \
268 SAVE_REGS \
269 brid 2f; \
270 swi r1, r1, PT_MODE; \
271 1: \
272 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \
273 tophys(r1,r1); \
274 lwi r1, r1, TS_THREAD_INFO; \
275 \
276 \
277 \
278 \
279 addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \
280 SAVE_REGS \
281 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
282 swi r11, r1, PT_R1; \
283 swi r0, r1, PT_MODE; \
284 \
285 clear_ums; \
286 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
287
288 .text
289
290
291
292
293
294
295
296
297
298
299
300
301
302 C_ENTRY(_user_exception):
303 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
304 addi r14, r14, 4
305
306 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
307 tophys(r1,r1);
308 lwi r1, r1, TS_THREAD_INFO;
309
310 addik r1, r1, THREAD_SIZE;
311 tophys(r1,r1);
312
313 addik r1, r1, -PT_SIZE;
314 SAVE_REGS
315 swi r0, r1, PT_R3
316 swi r0, r1, PT_R4
317
318 swi r0, r1, PT_MODE;
319 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
320 swi r11, r1, PT_R1;
321 clear_ums;
322 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
323
324 swi r12, r1, PT_R0;
325 tovirt(r1,r1)
326
327
328
329
330
331
332
333
334 rtbd r0, 3f
335 nop
336 3:
337 lwi r11, CURRENT_TASK, TS_THREAD_INFO
338 lwi r11, r11, TI_FLAGS
339 andi r11, r11, _TIF_WORK_SYSCALL_MASK
340 beqi r11, 4f
341
342 addik r3, r0, -ENOSYS
343 swi r3, r1, PT_R3
344 brlid r15, do_syscall_trace_enter
345 addik r5, r1, PT_R0
346
347
348 addk r12, r0, r3
349 lwi r5, r1, PT_R5;
350 lwi r6, r1, PT_R6;
351 lwi r7, r1, PT_R7;
352 lwi r8, r1, PT_R8;
353 lwi r9, r1, PT_R9;
354 lwi r10, r1, PT_R10;
355 4:
356
357
358
359
360
361 blti r12, 5f
362 addi r11, r12, -__NR_syscalls;
363 bgei r11, 5f;
364
365
366 add r12, r12, r12;
367 add r12, r12, r12;
368 addi r30, r0, 1
369
370 #ifdef DEBUG
371
372
373 lwi r3, r0, syscall_debug_table
374 addi r3, r3, 1
375 swi r3, r0, syscall_debug_table
376 lwi r3, r12, syscall_debug_table
377 addi r3, r3, 1
378 swi r3, r12, syscall_debug_table
379 #endif
380
381
382 lwi r12, r12, sys_call_table
383
384 addi r15, r0, ret_from_trap-8
385 bra r12
386
387
388 5:
389 braid ret_from_trap
390 addi r3, r0, -ENOSYS;
391
392
393
394 C_ENTRY(ret_from_trap):
395 swi r3, r1, PT_R3
396 swi r4, r1, PT_R4
397
398 lwi r11, r1, PT_MODE;
399
400 bnei r11, 2f;
401
402
403
404 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
405 lwi r11, r11, TI_FLAGS;
406 andi r11, r11, _TIF_WORK_SYSCALL_MASK
407 beqi r11, 1f
408
409 brlid r15, do_syscall_trace_leave
410 addik r5, r1, PT_R0
411 1:
412
413
414
415 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
416 lwi r19, r11, TI_FLAGS;
417 andi r11, r19, _TIF_NEED_RESCHED;
418 beqi r11, 5f;
419
420 bralid r15, schedule;
421 nop;
422 bri 1b
423
424
425 5:
426 andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
427 beqi r11, 4f;
428
429 addik r5, r1, 0;
430 bralid r15, do_notify_resume;
431 add r6, r30, r0;
432 add r30, r0, r0
433 bri 1b
434
435
436 4: set_bip;
437 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
438 VM_OFF;
439 tophys(r1,r1);
440 RESTORE_REGS_RTBD;
441 addik r1, r1, PT_SIZE
442 lwi r1, r1, PT_R1 - PT_SIZE;
443 bri 6f;
444
445
446 2: set_bip;
447 VM_OFF;
448 tophys(r1,r1);
449 RESTORE_REGS_RTBD;
450 addik r1, r1, PT_SIZE
451 tovirt(r1,r1);
452 6:
453 TRAP_return:
454 rtbd r14, 0;
455 nop;
456
457
458
459
460
461
462
463 C_ENTRY(ret_from_fork):
464 bralid r15, schedule_tail;
465 add r5, r3, r0;
466
467 brid ret_from_trap;
468 add r3, r0, r0;
469
470 C_ENTRY(ret_from_kernel_thread):
471 bralid r15, schedule_tail;
472 add r5, r3, r0;
473
474 brald r15, r20
475 addk r5, r0, r19
476 brid ret_from_trap
477 add r3, r0, r0
478
479 C_ENTRY(sys_rt_sigreturn_wrapper):
480 addik r30, r0, 0
481 brid sys_rt_sigreturn
482 addik r5, r1, 0;
483
484
485
486
487 C_ENTRY(full_exception_trap):
488
489
490 addik r17, r17, -4
491 SAVE_STATE
492
493 swi r17, r1, PT_PC;
494 tovirt(r1,r1)
495
496
497
498 addik r15, r0, ret_from_exc - 8
499 mfs r6, resr
500 mfs r7, rfsr;
501 mts rfsr, r0;
502 rted r0, full_exception
503 addik r5, r1, 0
504
505
506
507
508
509
510
511
512
513
514
515 C_ENTRY(unaligned_data_trap):
516
517
518
519
520
521
522 swi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
523 set_bip;
524 clear_eip;
525 set_ee;
526 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
527 SAVE_STATE
528
529 swi r17, r1, PT_PC;
530 tovirt(r1,r1)
531
532 addik r15, r0, ret_from_exc-8
533 mfs r3, resr
534 mfs r4, rear
535 rtbd r0, _unaligned_data_exception
536 addik r7, r1, 0
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556 C_ENTRY(page_fault_data_trap):
557 SAVE_STATE
558
559 swi r17, r1, PT_PC;
560 tovirt(r1,r1)
561
562 addik r15, r0, ret_from_exc-8
563 mfs r6, rear
564 mfs r7, resr
565 rted r0, do_page_fault
566 addik r5, r1, 0
567
568 C_ENTRY(page_fault_instr_trap):
569 SAVE_STATE
570
571 swi r17, r1, PT_PC;
572 tovirt(r1,r1)
573
574 addik r15, r0, ret_from_exc-8
575 mfs r6, rear
576 ori r7, r0, 0
577 rted r0, do_page_fault
578 addik r5, r1, 0
579
580
581 C_ENTRY(ret_from_exc):
582 lwi r11, r1, PT_MODE;
583 bnei r11, 2f;
584
585
586
587
588 1:
589 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
590 lwi r19, r11, TI_FLAGS;
591 andi r11, r19, _TIF_NEED_RESCHED;
592 beqi r11, 5f;
593
594
595 bralid r15, schedule;
596 nop;
597 bri 1b
598
599
600 5: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
601 beqi r11, 4f;
602
603
604
605
606
607
608
609
610
611
612
613
614 addik r5, r1, 0;
615 bralid r15, do_notify_resume;
616 addi r6, r0, 0;
617 bri 1b
618
619
620 4: set_bip;
621 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
622 VM_OFF;
623 tophys(r1,r1);
624
625 RESTORE_REGS_RTBD;
626 addik r1, r1, PT_SIZE
627
628 lwi r1, r1, PT_R1 - PT_SIZE;
629 bri 6f;
630
631 2: set_bip;
632 VM_OFF;
633 tophys(r1,r1);
634 RESTORE_REGS_RTBD;
635 addik r1, r1, PT_SIZE
636
637 tovirt(r1,r1);
638 6:
639 EXC_return:
640 rtbd r14, 0;
641 nop;
642
643
644
645
646
647
648
649
650
651
652
653 C_ENTRY(_interrupt):
654
655
656 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
657
658 mfs r1, rmsr
659 nop
660 andi r1, r1, MSR_UMS
661 bnei r1, 1f
662
663
664 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
665 tophys(r1,r1);
666
667
668 addik r1, r1, -PT_SIZE;
669 SAVE_REGS
670 brid 2f;
671 swi r1, r1, PT_MODE;
672 1:
673
674
675 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
676 tophys(r1,r1);
677 lwi r1, r1, TS_THREAD_INFO;
678 addik r1, r1, THREAD_SIZE;
679 tophys(r1,r1);
680
681 addik r1, r1, -PT_SIZE;
682 SAVE_REGS
683
684 swi r0, r1, PT_MODE;
685 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
686 swi r11, r1, PT_R1;
687 clear_ums;
688 2:
689 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
690 tovirt(r1,r1)
691 addik r15, r0, irq_call;
692 irq_call:rtbd r0, do_IRQ;
693 addik r5, r1, 0;
694
695
696 ret_from_irq:
697 lwi r11, r1, PT_MODE;
698 bnei r11, 2f;
699
700 1:
701 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
702 lwi r19, r11, TI_FLAGS;
703 andi r11, r19, _TIF_NEED_RESCHED;
704 beqi r11, 5f
705 bralid r15, schedule;
706 nop;
707 bri 1b
708
709
710 5: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
711 beqid r11, no_intr_resched
712
713 addik r5, r1, 0;
714 bralid r15, do_notify_resume;
715 addi r6, r0, 0;
716 bri 1b
717
718
719 no_intr_resched:
720
721 disable_irq
722 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
723 VM_OFF;
724 tophys(r1,r1);
725 RESTORE_REGS
726 addik r1, r1, PT_SIZE
727 lwi r1, r1, PT_R1 - PT_SIZE;
728 bri 6f;
729
730 2:
731 #ifdef CONFIG_PREEMPT
732 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
733
734 lwi r5, r11, TI_PREEMPT_COUNT;
735 bgti r5, restore;
736
737 lwi r5, r11, TI_FLAGS;
738 andi r5, r5, _TIF_NEED_RESCHED;
739 beqi r5, restore
740
741 preempt:
742
743 bralid r15, preempt_schedule_irq
744 nop
745 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
746 lwi r5, r11, TI_FLAGS;
747 andi r5, r5, _TIF_NEED_RESCHED;
748 bnei r5, preempt
749 restore:
750 #endif
751 VM_OFF
752 tophys(r1,r1)
753 RESTORE_REGS
754 addik r1, r1, PT_SIZE
755 tovirt(r1,r1);
756 6:
757 IRQ_return:
758 rtid r14, 0
759 nop
760
761
762
763
764
765 C_ENTRY(_debug_exception):
766
767 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
768
769 mfs r1, rmsr
770 nop
771 andi r1, r1, MSR_UMS
772 bnei r1, 1f
773
774 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP));
775
776
777 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE;
778 SAVE_REGS;
779
780 swi r0, r1, PT_R0;
781 swi r14, r1, PT_R14
782 swi r16, r1, PT_PC;
783
784 mfs r11, rear;
785 swi r11, r1, PT_EAR;
786 mfs r11, resr;
787 swi r11, r1, PT_ESR;
788 mfs r11, rfsr;
789 swi r11, r1, PT_FSR;
790
791
792
793 addik r11, r1, CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR + PT_SIZE;
794 swi r11, r1, PT_R1
795
796 tovirt(r1,r1)
797 #ifdef CONFIG_KGDB
798 addi r5, r1, 0
799 addik r15, r0, dbtrap_call;
800 rtbd r0, microblaze_kgdb_break
801 nop;
802 #endif
803
804
805 bri 0
806
807
808 1: lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
809 tophys(r1,r1);
810 lwi r1, r1, TS_THREAD_INFO;
811 addik r1, r1, THREAD_SIZE;
812 tophys(r1,r1);
813
814 addik r1, r1, -PT_SIZE;
815 SAVE_REGS;
816 swi r16, r1, PT_PC;
817 swi r0, r1, PT_MODE;
818 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
819 swi r11, r1, PT_R1;
820 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
821 tovirt(r1,r1)
822 set_vms;
823 addik r5, r1, 0;
824 addik r15, r0, dbtrap_call;
825 dbtrap_call:
826 rtbd r0, sw_exception
827 nop
828
829
830 set_bip;
831 lwi r11, r1, PT_MODE;
832 bnei r11, 2f;
833
834 1:
835
836 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
837 lwi r19, r11, TI_FLAGS;
838 andi r11, r19, _TIF_NEED_RESCHED;
839 beqi r11, 5f;
840
841
842 bralid r15, schedule;
843 nop;
844 bri 1b
845
846
847 5: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
848 beqi r11, 4f;
849
850 addik r5, r1, 0;
851 bralid r15, do_notify_resume;
852 addi r6, r0, 0;
853 bri 1b
854
855
856 4: swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
857 VM_OFF;
858 tophys(r1,r1);
859
860 RESTORE_REGS_RTBD
861 addik r1, r1, PT_SIZE
862 lwi r1, r1, PT_R1 - PT_SIZE;
863 DBTRAP_return_user:
864 rtbd r16, 0;
865 nop;
866
867
868 2: VM_OFF;
869 tophys(r1,r1);
870
871 RESTORE_REGS_RTBD
872 lwi r14, r1, PT_R14;
873 lwi r16, r1, PT_PC;
874 addik r1, r1, PT_SIZE;
875 tovirt(r1,r1);
876 DBTRAP_return_kernel:
877 rtbd r16, 0;
878 nop;
879
880
881 ENTRY(_switch_to)
882
883 addk r3, r0, CURRENT_TASK
884
885
886
887
888 addik r11, r5, TI_CPU_CONTEXT
889 swi r1, r11, CC_R1
890 swi r2, r11, CC_R2
891
892
893
894 swi r13, r11, CC_R13
895 swi r14, r11, CC_R14
896 swi r15, r11, CC_R15
897 swi r16, r11, CC_R16
898 swi r17, r11, CC_R17
899 swi r18, r11, CC_R18
900
901 swi r19, r11, CC_R19
902 swi r20, r11, CC_R20
903 swi r21, r11, CC_R21
904 swi r22, r11, CC_R22
905 swi r23, r11, CC_R23
906 swi r24, r11, CC_R24
907 swi r25, r11, CC_R25
908 swi r26, r11, CC_R26
909 swi r27, r11, CC_R27
910 swi r28, r11, CC_R28
911 swi r29, r11, CC_R29
912 swi r30, r11, CC_R30
913
914 mfs r12, rmsr
915 swi r12, r11, CC_MSR
916 mfs r12, rear
917 swi r12, r11, CC_EAR
918 mfs r12, resr
919 swi r12, r11, CC_ESR
920 mfs r12, rfsr
921 swi r12, r11, CC_FSR
922
923
924 lwi CURRENT_TASK, r6, TI_TASK
925
926 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE)
927
928
929
930 addik r11, r6, TI_CPU_CONTEXT
931
932
933 lwi r30, r11, CC_R30
934 lwi r29, r11, CC_R29
935 lwi r28, r11, CC_R28
936 lwi r27, r11, CC_R27
937 lwi r26, r11, CC_R26
938 lwi r25, r11, CC_R25
939 lwi r24, r11, CC_R24
940 lwi r23, r11, CC_R23
941 lwi r22, r11, CC_R22
942 lwi r21, r11, CC_R21
943 lwi r20, r11, CC_R20
944 lwi r19, r11, CC_R19
945
946 lwi r18, r11, CC_R18
947 lwi r17, r11, CC_R17
948 lwi r16, r11, CC_R16
949 lwi r15, r11, CC_R15
950 lwi r14, r11, CC_R14
951 lwi r13, r11, CC_R13
952
953 lwi r2, r11, CC_R2
954 lwi r1, r11, CC_R1
955
956
957 lwi r12, r11, CC_FSR
958 mts rfsr, r12
959 lwi r12, r11, CC_MSR
960 mts rmsr, r12
961
962 rtsd r15, 8
963 nop
964
965 ENTRY(_reset)
966 brai 0;
967
968
969
970 .section .init.ivt, "ax"
971 #if CONFIG_MANUAL_RESET_VECTOR
972 .org 0x0
973 brai CONFIG_MANUAL_RESET_VECTOR
974 #endif
975 .org 0x8
976 brai TOPHYS(_user_exception);
977 .org 0x10
978 brai TOPHYS(_interrupt);
979 .org 0x18
980 brai TOPHYS(_debug_exception);
981 .org 0x20
982 brai TOPHYS(_hw_exception_handler);
983
984 .section .rodata,"a"
985 #include "syscall_table.S"
986
987 syscall_table_size=(.-sys_call_table)
988
989 type_SYSCALL:
990 .ascii "SYSCALL\0"
991 type_IRQ:
992 .ascii "IRQ\0"
993 type_IRQ_PREEMPT:
994 .ascii "IRQ (PREEMPTED)\0"
995 type_SYSCALL_PREEMPT:
996 .ascii " SYSCALL (PREEMPTED)\0"
997
998
999
1000
1001
1002
1003
1004
1005 .align 4
1006 .global microblaze_trap_handlers
1007 microblaze_trap_handlers:
1008
1009 .word ret_from_trap; .word ret_from_trap ; .word type_SYSCALL
1010 .word ret_from_irq ; .word ret_from_irq ; .word type_IRQ
1011
1012 .word ret_from_irq ; .word no_intr_resched ; .word type_IRQ_PREEMPT
1013 .word ret_from_trap; .word TRAP_return ; .word type_SYSCALL_PREEMPT
1014
1015 .word 0 ; .word 0 ; .word 0