1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <linux/threads.h>
28
29 #include <asm/asmmacro.h>
30 #include <asm/pgtable.h>
31 #include <asm/processor.h>
32 #include <asm/mca_asm.h>
33 #include <asm/mca.h>
34
35 #include "entry.h"
36
37 #define GET_IA64_MCA_DATA(reg) \
38 GET_THIS_PADDR(reg, ia64_mca_data) \
39 ;; \
40 ld8 reg=[reg]
41
42 .global ia64_do_tlb_purge
43 .global ia64_os_mca_dispatch
44 .global ia64_os_init_on_kdump
45 .global ia64_os_init_dispatch_monarch
46 .global ia64_os_init_dispatch_slave
47
48 .text
49 .align 16
50
51
52
53
54
55
56
57
58
59
60 ia64_do_tlb_purge:
61 #define O(member) IA64_CPUINFO_##member##_OFFSET
62
63 GET_THIS_PADDR(r2, ia64_cpu_info)
64 ;;
65 addl r17=O(PTCE_STRIDE),r2
66 addl r2=O(PTCE_BASE),r2
67 ;;
68 ld8 r18=[r2],(O(PTCE_COUNT)-O(PTCE_BASE));;
69 ld4 r19=[r2],4
70 ld4 r21=[r17],4
71 ;;
72 ld4 r20=[r2]
73 ld4 r22=[r17]
74 mov r24=0
75 ;;
76 adds r20=-1,r20
77 ;;
78 #undef O
79
80 2:
81 cmp.ltu p6,p7=r24,r19
82 (p7) br.cond.dpnt.few 4f
83 mov ar.lc=r20
84 3:
85 ptc.e r18
86 ;;
87 add r18=r22,r18
88 br.cloop.sptk.few 3b
89 ;;
90 add r18=r21,r18
91 add r24=1,r24
92 ;;
93 br.sptk.few 2b
94 4:
95 srlz.i
96 ;;
97
98
99
100 movl r16=KERNEL_START
101 mov r18=KERNEL_TR_PAGE_SHIFT<<2
102 ;;
103 ptr.i r16, r18
104 ptr.d r16, r18
105 ;;
106 srlz.i
107 ;;
108 srlz.d
109 ;;
110
111 GET_THIS_PADDR(r2, ia64_mca_pal_base)
112 ;;
113 ld8 r16=[r2]
114 mov r18=IA64_GRANULE_SHIFT<<2
115 ;;
116 ptr.i r16,r18
117 ;;
118 srlz.i
119 ;;
120
121 mov r16=IA64_KR(CURRENT_STACK)
122 ;;
123 shl r16=r16,IA64_GRANULE_SHIFT
124 movl r19=PAGE_OFFSET
125 ;;
126 add r16=r19,r16
127 mov r18=IA64_GRANULE_SHIFT<<2
128 ;;
129 ptr.d r16,r18
130 ;;
131 srlz.i
132 ;;
133
134 br.sptk.many b1
135 ;;
136
137
138
139
140
141 ia64_os_mca_dispatch:
142 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET
143 LOAD_PHYSICAL(p0,r2,1f)
144 mov r19=1
145 br.sptk ia64_state_save
146 1:
147
148 GET_IA64_MCA_DATA(r2)
149
150 ;;
151 add r3=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET+SOS(PROC_STATE_PARAM), r2
152 ;;
153 ld8 r18=[r3]
154 ;;
155 tbit.nz p6,p7=r18,60
156 (p7) br.spnt done_tlb_purge_and_reload
157
158
159
160 begin_tlb_purge_and_reload:
161 movl r18=ia64_reload_tr;;
162 LOAD_PHYSICAL(p0,r18,ia64_reload_tr);;
163 mov b1=r18;;
164 br.sptk.many ia64_do_tlb_purge;;
165
166 ia64_reload_tr:
167
168
169 mov r18=KERNEL_TR_PAGE_SHIFT<<2
170 movl r17=KERNEL_START
171 ;;
172 mov cr.itir=r18
173 mov cr.ifa=r17
174 mov r16=IA64_TR_KERNEL
175 mov r19=ip
176 movl r18=PAGE_KERNEL
177 ;;
178 dep r17=0,r19,0, KERNEL_TR_PAGE_SHIFT
179 ;;
180 or r18=r17,r18
181 ;;
182 itr.i itr[r16]=r18
183 ;;
184 itr.d dtr[r16]=r18
185 ;;
186 srlz.i
187 srlz.d
188 ;;
189
190 GET_THIS_PADDR(r2, ia64_mca_pal_pte)
191 ;;
192 ld8 r18=[r2]
193 ;;
194 GET_THIS_PADDR(r2, ia64_mca_pal_base)
195 ;;
196 ld8 r16=[r2]
197 mov r19=IA64_GRANULE_SHIFT<<2
198 ;;
199 mov cr.itir=r19
200 mov cr.ifa=r16
201 mov r20=IA64_TR_PALCODE
202 ;;
203 itr.i itr[r20]=r18
204 ;;
205 srlz.i
206 ;;
207
208 mov r16=IA64_KR(CURRENT_STACK)
209 ;;
210 shl r16=r16,IA64_GRANULE_SHIFT
211 movl r19=PAGE_OFFSET
212 ;;
213 add r18=r19,r16
214 movl r20=PAGE_KERNEL
215 ;;
216 add r16=r20,r16
217 mov r19=IA64_GRANULE_SHIFT<<2
218 ;;
219 mov cr.itir=r19
220 mov cr.ifa=r18
221 mov r20=IA64_TR_CURRENT_STACK
222 ;;
223 itr.d dtr[r20]=r16
224 GET_THIS_PADDR(r2, ia64_mca_tr_reload)
225 mov r18 = 1
226 ;;
227 srlz.d
228 ;;
229 st8 [r2] =r18
230 ;;
231
232 done_tlb_purge_and_reload:
233
234
235 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET
236 LOAD_PHYSICAL(p0,r2,1f)
237 br.sptk ia64_new_stack
238 1:
239
240
241 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET
242 LOAD_PHYSICAL(p0,r2,1f)
243 br.sptk ia64_set_kernel_registers
244 1:
245
246
247 GET_IA64_MCA_DATA(r2)
248 ;;
249 mov r7=r2
250
251
252 VIRTUAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_begin, r4)
253
254
255
256
257
258 ENTRY(ia64_os_mca_virtual_begin)
259 .prologue
260 .save rp,r0
261 .body
262
263 mov ar.rsc=3
264 mov r2=r7
265 ;;
266
267
268 alloc r14=ar.pfs,0,0,3,0
269 ;;
270 DATA_PA_TO_VA(r2,r7)
271 ;;
272 add out0=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_PT_REGS_OFFSET, r2
273 add out1=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SWITCH_STACK_OFFSET, r2
274 add out2=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET, r2
275 br.call.sptk.many b0=ia64_mca_handler
276
277
278 PHYSICAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_end, r4)
279 ia64_os_mca_virtual_end:
280
281 END(ia64_os_mca_virtual_begin)
282
283
284 alloc r14=ar.pfs,0,0,0,0
285 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET
286 LOAD_PHYSICAL(p0,r2,1f)
287 br.sptk ia64_old_stack
288 1:
289
290 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET
291 LOAD_PHYSICAL(p0,r2,1f)
292 br.sptk ia64_state_restore
293 1:
294
295 mov b0=r12
296
297 br b0
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313 ia64_os_init_on_kdump:
314 mov r8=r0
315 mov r9=r10
316 mov r22=r17
317 ;;
318 mov r10=r0
319 mov b0=r12
320 br b0
321
322
323
324
325
326
327
328
329 ia64_os_init_dispatch_monarch:
330 mov r19=1
331 br.sptk ia64_os_init_dispatch
332
333 ia64_os_init_dispatch_slave:
334 mov r19=0
335
336 ia64_os_init_dispatch:
337
338 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET
339 LOAD_PHYSICAL(p0,r2,1f)
340 br.sptk ia64_state_save
341 1:
342
343
344 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET
345 LOAD_PHYSICAL(p0,r2,1f)
346 br.sptk ia64_new_stack
347 1:
348
349
350 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET
351 LOAD_PHYSICAL(p0,r2,1f)
352 br.sptk ia64_set_kernel_registers
353 1:
354
355
356 GET_IA64_MCA_DATA(r2)
357 ;;
358 mov r7=r2
359
360
361 VIRTUAL_MODE_ENTER(r2, r3, ia64_os_init_virtual_begin, r4)
362
363
364
365
366
367 ENTRY(ia64_os_init_virtual_begin)
368 .prologue
369 .save rp,r0
370 .body
371
372 mov ar.rsc=3
373 mov r2=r7
374 ;;
375
376
377 alloc r14=ar.pfs,0,0,3,0
378 ;;
379 DATA_PA_TO_VA(r2,r7)
380 ;;
381 add out0=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_PT_REGS_OFFSET, r2
382 add out1=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_SWITCH_STACK_OFFSET, r2
383 add out2=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_SOS_OFFSET, r2
384 br.call.sptk.many b0=ia64_init_handler
385
386
387 PHYSICAL_MODE_ENTER(r2, r3, ia64_os_init_virtual_end, r4)
388 ia64_os_init_virtual_end:
389
390 END(ia64_os_init_virtual_begin)
391
392 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET
393 LOAD_PHYSICAL(p0,r2,1f)
394 br.sptk ia64_state_restore
395 1:
396
397
398 alloc r14=ar.pfs,0,0,0,0
399 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET
400 LOAD_PHYSICAL(p0,r2,1f)
401 br.sptk ia64_old_stack
402 1:
403
404 mov b0=r12
405 br b0
406
407
408
409
410 #define ms r4
411 #define regs r5
412 #define temp1 r2
413 #define temp2 r3
414 #define temp3 r7
415 #define temp4 r14
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456 ia64_state_save:
457 add regs=MCA_SOS_OFFSET, r3
458 add ms=MCA_SOS_OFFSET+8, r3
459 mov b0=r2
460 cmp.eq p1,p2=IA64_MCA_CPU_MCA_STACK_OFFSET, r3
461 ;;
462 GET_IA64_MCA_DATA(temp2)
463 ;;
464 add temp1=temp2, regs
465 add temp2=temp2, ms
466 ;;
467 mov regs=temp1
468 st8 [temp1]=r1,16
469 st8 [temp2]=r8,16
470 ;;
471 st8 [temp1]=r9,16
472 st8 [temp2]=r11,16
473 mov r11=cr.iipa
474 ;;
475 st8 [temp1]=r18
476 st8 [temp2]=r19
477 mov r6=IA64_KR(CURRENT)
478 add temp1=SOS(SAL_RA), regs
479 add temp2=SOS(SAL_GP), regs
480 ;;
481 st8 [temp1]=r12,16
482 st8 [temp2]=r10,16
483 mov r12=cr.isr
484 ;;
485 st8 [temp1]=r17,16
486 st8 [temp2]=r6,16
487 mov r6=IA64_KR(CURRENT_STACK)
488 ;;
489 st8 [temp1]=r6,16
490 st8 [temp2]=r0,16
491 mov r6=cr.ifa
492 ;;
493 st8 [temp1]=r12,16
494 st8 [temp2]=r6,16
495 mov r12=cr.itir
496 ;;
497 st8 [temp1]=r12,16
498 st8 [temp2]=r11,16
499 mov r12=cr.iim
500 ;;
501 st8 [temp1]=r12
502 (p1) mov r12=IA64_MCA_COLD_BOOT
503 (p2) mov r12=IA64_INIT_WARM_BOOT
504 mov r6=cr.iha
505 add temp1=SOS(OS_STATUS), regs
506 ;;
507 st8 [temp2]=r6
508 add temp2=SOS(CONTEXT), regs
509 st8 [temp1]=r12
510 mov r6=IA64_MCA_SAME_CONTEXT
511 ;;
512 st8 [temp2]=r6
513
514
515
516 add regs=MCA_PT_REGS_OFFSET-MCA_SOS_OFFSET, regs
517 ;;
518 add temp1=PT(B6), regs
519 mov temp3=b6
520 mov temp4=b7
521 add temp2=PT(B7), regs
522 ;;
523 st8 [temp1]=temp3,PT(AR_CSD)-PT(B6)
524 st8 [temp2]=temp4,PT(AR_SSD)-PT(B7)
525 mov temp3=ar.csd
526 mov temp4=ar.ssd
527 cover
528 ;;
529 st8 [temp1]=temp3,PT(AR_UNAT)-PT(AR_CSD)
530 st8 [temp2]=temp4,PT(AR_PFS)-PT(AR_SSD)
531 mov temp3=ar.unat
532 mov temp4=ar.pfs
533 ;;
534 st8 [temp1]=temp3,PT(AR_RNAT)-PT(AR_UNAT)
535 st8 [temp2]=temp4,PT(AR_BSPSTORE)-PT(AR_PFS)
536 mov temp3=ar.rnat
537 mov temp4=ar.bspstore
538 ;;
539 st8 [temp1]=temp3,PT(LOADRS)-PT(AR_RNAT)
540 st8 [temp2]=temp4,PT(AR_FPSR)-PT(AR_BSPSTORE)
541 mov temp3=ar.bsp
542 ;;
543 sub temp3=temp3, temp4
544 mov temp4=ar.fpsr
545 ;;
546 shl temp3=temp3,16
547 ;;
548 st8 [temp1]=temp3,PT(AR_CCV)-PT(LOADRS)
549 st8 [temp2]=temp4,PT(F6)-PT(AR_FPSR)
550 mov temp3=ar.ccv
551 ;;
552 st8 [temp1]=temp3,PT(F7)-PT(AR_CCV)
553 stf.spill [temp2]=f6,PT(F8)-PT(F6)
554 ;;
555 stf.spill [temp1]=f7,PT(F9)-PT(F7)
556 stf.spill [temp2]=f8,PT(F10)-PT(F8)
557 ;;
558 stf.spill [temp1]=f9,PT(F11)-PT(F9)
559 stf.spill [temp2]=f10
560 ;;
561 stf.spill [temp1]=f11
562
563
564
565 add regs=MCA_SWITCH_STACK_OFFSET-MCA_PT_REGS_OFFSET, regs
566 ;;
567 add temp1=SW(F2), regs
568 add temp2=SW(F3), regs
569 ;;
570 stf.spill [temp1]=f2,32
571 stf.spill [temp2]=f3,32
572 ;;
573 stf.spill [temp1]=f4,32
574 stf.spill [temp2]=f5,32
575 ;;
576 stf.spill [temp1]=f12,32
577 stf.spill [temp2]=f13,32
578 ;;
579 stf.spill [temp1]=f14,32
580 stf.spill [temp2]=f15,32
581 ;;
582 stf.spill [temp1]=f16,32
583 stf.spill [temp2]=f17,32
584 ;;
585 stf.spill [temp1]=f18,32
586 stf.spill [temp2]=f19,32
587 ;;
588 stf.spill [temp1]=f20,32
589 stf.spill [temp2]=f21,32
590 ;;
591 stf.spill [temp1]=f22,32
592 stf.spill [temp2]=f23,32
593 ;;
594 stf.spill [temp1]=f24,32
595 stf.spill [temp2]=f25,32
596 ;;
597 stf.spill [temp1]=f26,32
598 stf.spill [temp2]=f27,32
599 ;;
600 stf.spill [temp1]=f28,32
601 stf.spill [temp2]=f29,32
602 ;;
603 stf.spill [temp1]=f30,SW(B2)-SW(F30)
604 stf.spill [temp2]=f31,SW(B3)-SW(F31)
605 mov temp3=b2
606 mov temp4=b3
607 ;;
608 st8 [temp1]=temp3,16
609 st8 [temp2]=temp4,16
610 mov temp3=b4
611 mov temp4=b5
612 ;;
613 st8 [temp1]=temp3,SW(AR_LC)-SW(B4)
614 st8 [temp2]=temp4
615 mov temp3=ar.lc
616 ;;
617 st8 [temp1]=temp3
618
619
620
621
622
623
624
625
626 add r1=32*1,r17
627 add r2=32*2,r17
628 add r3=32*3,r17
629 add r4=32*4,r17
630 add r5=32*5,r17
631 add r6=32*6,r17
632 add r7=32*7,r17
633 ;;
634 fc r17
635 fc r1
636 fc r2
637 fc r3
638 fc r4
639 fc r5
640 fc r6
641 fc r7
642 add r17=32*8,r17
643 add r1=32*8,r1
644 add r2=32*8,r2
645 add r3=32*8,r3
646 add r4=32*8,r4
647 add r5=32*8,r5
648 add r6=32*8,r6
649 add r7=32*8,r7
650 ;;
651 fc r17
652 fc r1
653 fc r2
654 fc r3
655 fc r4
656 fc r5
657 fc r6
658 fc r7
659 add r17=32*8,r17
660 add r1=32*8,r1
661 add r2=32*8,r2
662 add r3=32*8,r3
663 add r4=32*8,r4
664 add r5=32*8,r5
665 add r6=32*8,r6
666 add r7=32*8,r7
667 ;;
668 fc r17
669 fc r1
670 fc r2
671 fc r3
672 fc r4
673 fc r5
674 fc r6
675 fc r7
676 add r17=32*8,r17
677 add r1=32*8,r1
678 add r2=32*8,r2
679 add r3=32*8,r3
680 add r4=32*8,r4
681 add r5=32*8,r5
682 add r6=32*8,r6
683 add r7=32*8,r7
684 ;;
685 fc r17
686 fc r1
687 fc r2
688 fc r3
689 fc r4
690 fc r5
691 fc r6
692 fc r7
693
694 br.sptk b0
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717 ia64_state_restore:
718
719 add regs=MCA_SWITCH_STACK_OFFSET, r3
720 mov b0=r2
721 ;;
722 GET_IA64_MCA_DATA(temp2)
723 ;;
724 add regs=temp2, regs
725 ;;
726 add temp1=SW(F2), regs
727 add temp2=SW(F3), regs
728 ;;
729 ldf.fill f2=[temp1],32
730 ldf.fill f3=[temp2],32
731 ;;
732 ldf.fill f4=[temp1],32
733 ldf.fill f5=[temp2],32
734 ;;
735 ldf.fill f12=[temp1],32
736 ldf.fill f13=[temp2],32
737 ;;
738 ldf.fill f14=[temp1],32
739 ldf.fill f15=[temp2],32
740 ;;
741 ldf.fill f16=[temp1],32
742 ldf.fill f17=[temp2],32
743 ;;
744 ldf.fill f18=[temp1],32
745 ldf.fill f19=[temp2],32
746 ;;
747 ldf.fill f20=[temp1],32
748 ldf.fill f21=[temp2],32
749 ;;
750 ldf.fill f22=[temp1],32
751 ldf.fill f23=[temp2],32
752 ;;
753 ldf.fill f24=[temp1],32
754 ldf.fill f25=[temp2],32
755 ;;
756 ldf.fill f26=[temp1],32
757 ldf.fill f27=[temp2],32
758 ;;
759 ldf.fill f28=[temp1],32
760 ldf.fill f29=[temp2],32
761 ;;
762 ldf.fill f30=[temp1],SW(B2)-SW(F30)
763 ldf.fill f31=[temp2],SW(B3)-SW(F31)
764 ;;
765 ld8 temp3=[temp1],16
766 ld8 temp4=[temp2],16
767 ;;
768 mov b2=temp3
769 mov b3=temp4
770 ld8 temp3=[temp1],SW(AR_LC)-SW(B4)
771 ld8 temp4=[temp2]
772 ;;
773 mov b4=temp3
774 mov b5=temp4
775 ld8 temp3=[temp1]
776 ;;
777 mov ar.lc=temp3
778
779
780
781 add regs=MCA_PT_REGS_OFFSET-MCA_SWITCH_STACK_OFFSET, regs
782 ;;
783 add temp1=PT(B6), regs
784 add temp2=PT(B7), regs
785 ;;
786 ld8 temp3=[temp1],PT(AR_CSD)-PT(B6)
787 ld8 temp4=[temp2],PT(AR_SSD)-PT(B7)
788 ;;
789 mov b6=temp3
790 mov b7=temp4
791 ld8 temp3=[temp1],PT(AR_UNAT)-PT(AR_CSD)
792 ld8 temp4=[temp2],PT(AR_PFS)-PT(AR_SSD)
793 ;;
794 mov ar.csd=temp3
795 mov ar.ssd=temp4
796 ld8 temp3=[temp1]
797 add temp1=PT(AR_CCV)-PT(AR_UNAT), temp1
798 ld8 temp4=[temp2],PT(AR_FPSR)-PT(AR_PFS)
799 ;;
800 mov ar.unat=temp3
801 mov ar.pfs=temp4
802
803 ld8 temp3=[temp1],PT(F6)-PT(AR_CCV)
804 ld8 temp4=[temp2],PT(F7)-PT(AR_FPSR)
805 ;;
806 mov ar.ccv=temp3
807 mov ar.fpsr=temp4
808 ldf.fill f6=[temp1],PT(F8)-PT(F6)
809 ldf.fill f7=[temp2],PT(F9)-PT(F7)
810 ;;
811 ldf.fill f8=[temp1],PT(F10)-PT(F8)
812 ldf.fill f9=[temp2],PT(F11)-PT(F9)
813 ;;
814 ldf.fill f10=[temp1]
815 ldf.fill f11=[temp2]
816
817
818 add regs=MCA_SOS_OFFSET-MCA_PT_REGS_OFFSET, regs
819 ;;
820 add temp1=SOS(SAL_RA), regs
821 add temp2=SOS(SAL_GP), regs
822 ;;
823 ld8 r12=[temp1],16
824 ld8 r9=[temp2],16
825 ;;
826 ld8 r22=[temp1],16
827 ld8 r13=[temp2],16
828 ;;
829 ld8 r16=[temp1],16
830 ld8 r20=[temp2],16
831 ;;
832 ld8 temp3=[temp1],16
833 ld8 temp4=[temp2],16
834 ;;
835 mov cr.isr=temp3
836 mov cr.ifa=temp4
837 ld8 temp3=[temp1],16
838 ld8 temp4=[temp2],16
839 ;;
840 mov cr.itir=temp3
841 mov cr.iipa=temp4
842 ld8 temp3=[temp1]
843 ld8 temp4=[temp2]
844 add temp1=SOS(OS_STATUS), regs
845 add temp2=SOS(CONTEXT), regs
846 ;;
847 mov cr.iim=temp3
848 mov cr.iha=temp4
849 dep r22=0,r22,62,1
850 mov IA64_KR(CURRENT)=r13
851 ld8 r8=[temp1]
852 ld8 r10=[temp2]
853
854
855
856
857
858
859
860
861
862
863
864 mov r15=IA64_KR(CURRENT_STACK)
865 ;;
866 shl r15=r15,IA64_GRANULE_SHIFT
867 ;;
868 dep r15=-1,r15,61,3
869 mov r18=IA64_GRANULE_SHIFT<<2
870 ;;
871 ptr.d r15,r18
872 ;;
873 srlz.d
874
875 extr.u r19=r13,61,3
876 shl r20=r16,IA64_GRANULE_SHIFT
877 movl r21=PAGE_KERNEL
878 ;;
879 mov IA64_KR(CURRENT_STACK)=r16
880 cmp.ne p6,p0=RGN_KERNEL,r19
881 or r21=r20,r21
882 (p6) br.spnt 1f
883 ;;
884 mov cr.itir=r18
885 mov cr.ifa=r13
886 mov r20=IA64_TR_CURRENT_STACK
887 ;;
888 itr.d dtr[r20]=r21
889 ;;
890 srlz.d
891 1:
892
893 br.sptk b0
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916 ia64_new_stack:
917 add regs=MCA_PT_REGS_OFFSET, r3
918 add temp2=MCA_SOS_OFFSET+SOS(PAL_MIN_STATE), r3
919 mov b0=r2
920 GET_IA64_MCA_DATA(temp1)
921 invala
922 ;;
923 add temp2=temp2, temp1
924 add regs=regs, temp1
925 ;;
926
927
928 ld8 ms=[temp2]
929 ;;
930 dep temp1=-1,ms,62,2
931 mov temp3=IA64_RBS_OFFSET-MCA_PT_REGS_OFFSET
932 ;;
933 st8 [temp2]=temp1
934
935 add temp4=temp3, regs
936 ;;
937 mov ar.bspstore=temp4
938 ;;
939 flushrs
940 br.sptk b0
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970 ia64_old_stack:
971 add regs=MCA_PT_REGS_OFFSET, r3
972 mov b0=r2
973 GET_IA64_MCA_DATA(temp2)
974 LOAD_PHYSICAL(p0,temp1,1f)
975 ;;
976 mov cr.ipsr=r0
977 mov cr.ifs=r0
978 mov cr.iip=temp1
979 ;;
980 invala
981 rfi
982 1:
983
984 add regs=regs, temp2
985 ;;
986 add temp1=PT(LOADRS), regs
987 ;;
988 ld8 temp2=[temp1],PT(AR_BSPSTORE)-PT(LOADRS)
989 ;;
990 ld8 temp3=[temp1],PT(AR_RNAT)-PT(AR_BSPSTORE)
991 mov ar.rsc=temp2
992 ;;
993 loadrs
994 ld8 temp4=[temp1]
995 ;;
996 mov ar.bspstore=temp3
997 ;;
998 mov ar.rnat=temp4
999 ;;
1000
1001 br.sptk b0
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020 ia64_set_kernel_registers:
1021 add temp3=MCA_SP_OFFSET, r3
1022 mov b0=r2
1023 GET_IA64_MCA_DATA(temp1)
1024 ;;
1025 add r12=temp1, temp3
1026 add r13=temp1, r3
1027 add r20=temp1, r3
1028 ;;
1029 DATA_PA_TO_VA(r12,temp2)
1030 DATA_PA_TO_VA(r13,temp3)
1031 ;;
1032 mov IA64_KR(CURRENT)=r13
1033
1034
1035
1036
1037
1038
1039 mov r16=IA64_KR(CURRENT_STACK)
1040 ;;
1041 shl r16=r16,IA64_GRANULE_SHIFT
1042 ;;
1043 dep r16=-1,r16,61,3
1044 mov r18=IA64_GRANULE_SHIFT<<2
1045 ;;
1046 ptr.d r16,r18
1047 ;;
1048 srlz.d
1049
1050 shr.u r16=r20,IA64_GRANULE_SHIFT
1051 movl r21=PAGE_KERNEL
1052 ;;
1053 mov IA64_KR(CURRENT_STACK)=r16
1054 or r21=r20,r21
1055 ;;
1056 mov cr.itir=r18
1057 mov cr.ifa=r13
1058 mov r20=IA64_TR_CURRENT_STACK
1059
1060 movl r17=FPSR_DEFAULT
1061 ;;
1062 mov.m ar.fpsr=r17
1063 ;;
1064 itr.d dtr[r20]=r21
1065 ;;
1066 srlz.d
1067
1068 br.sptk b0
1069
1070
1071
1072 #undef ms
1073 #undef regs
1074 #undef temp1
1075 #undef temp2
1076 #undef temp3
1077 #undef temp4
1078
1079
1080
1081
1082
1083
1084 GLOBAL_ENTRY(ia64_get_rnat)
1085 alloc r14=ar.pfs,1,0,0,0
1086 mov ar.rsc=0
1087 ;;
1088 mov r14=ar.bspstore
1089 ;;
1090 cmp.lt p6,p7=in0,r14
1091 ;;
1092 (p6) ld8 r8=[in0]
1093 (p7) mov r8=ar.rnat
1094 mov ar.rsc=3
1095 br.ret.sptk.many rp
1096 END(ia64_get_rnat)
1097
1098
1099
1100
1101
1102 GLOBAL_ENTRY(ia64_set_psr_mc)
1103 rsm psr.i | psr.ic
1104 ;;
1105 srlz.d
1106 ;;
1107 mov r14 = psr
1108 movl r15 = 1f
1109 ;;
1110 dep r14 = -1, r14, PSR_MC, 1
1111 ;;
1112 dep r14 = -1, r14, PSR_IC, 1
1113 ;;
1114 dep r14 = -1, r14, PSR_BN, 1
1115 ;;
1116 mov cr.ipsr = r14
1117 mov cr.ifs = r0
1118 mov cr.iip = r15
1119 ;;
1120 rfi
1121 1:
1122 br.ret.sptk.many rp
1123 END(ia64_set_psr_mc)