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#include <asm/asm-offsets.h>
26
27
28
29
30
31
32#include <asm/psw.h>
33#include <asm/cache.h>
34#include <asm/assembly.h>
35#include <asm/pgtable.h>
36#include <asm/signal.h>
37#include <asm/unistd.h>
38#include <asm/ldcw.h>
39#include <asm/traps.h>
40#include <asm/thread_info.h>
41#include <asm/alternative.h>
42
43#include <linux/linkage.h>
44
45#ifdef CONFIG_64BIT
46 .level 2.0w
47#else
48 .level 2.0
49#endif
50
51 .import pa_tlb_lock,data
52 .macro load_pa_tlb_lock reg
53
54 load32 PA(pa_tlb_lock) + __PA_LDCW_ALIGNMENT-1, \reg
55 depi 0,31,__PA_LDCW_ALIGN_ORDER, \reg
56#else
57 load32 PA(pa_tlb_lock), \reg
58#endif
59 .endm
60
61
62
63
64 .macro space_to_prot spc prot
65 depd,z \spc,62,31,\prot
66 .endm
67#else
68 .macro space_to_prot spc prot
69 extrd,u \spc,(64 - (SPACEID_SHIFT)),32,\prot
70 .endm
71#endif
72
73
74 .macro virt_map
75
76 rsm PSW_SM_I, %r0
77 mtsp %r0, %sr4
78 mtsp %r0, %sr5
79 mtsp %r0, %sr6
80 tovirt_r1 %r29
81 load32 KERNEL_PSW, %r1
82
83 rsm PSW_SM_QUIET,%r0
84 mtctl %r0, %cr17
85 mtctl %r0, %cr17
86 mtctl %r1, %ipsw
87 load32 4f, %r1
88 mtctl %r1, %cr18
89 ldo 4(%r1), %r1
90 mtctl %r1, %cr18
91 rfir
92 nop
934:
94 .endm
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 .macro get_stack_use_cr30
126
127
128
129 copy %r30, %r17
130 mfctl %cr30, %r1
131 ldo THREAD_SZ_ALGN(%r1), %r30
132 mtsp %r0,%sr7
133 mtsp %r16,%sr3
134 tophys %r1,%r9
135 LDREG TI_TASK(%r9), %r1
136 tophys %r1,%r9
137 ldo TASK_REGS(%r9),%r9
138 STREG %r17,PT_GR30(%r9)
139 STREG %r29,PT_GR29(%r9)
140 STREG %r26,PT_GR26(%r9)
141 STREG %r16,PT_SR7(%r9)
142 copy %r9,%r29
143 .endm
144
145 .macro get_stack_use_r30
146
147
148
149 tophys %r30,%r9
150 copy %r30,%r1
151 ldo PT_SZ_ALGN(%r30),%r30
152 STREG %r1,PT_GR30(%r9)
153 STREG %r29,PT_GR29(%r9)
154 STREG %r26,PT_GR26(%r9)
155 STREG %r16,PT_SR7(%r9)
156 copy %r9,%r29
157 .endm
158
159 .macro rest_stack
160 LDREG PT_GR1(%r29), %r1
161 LDREG PT_GR30(%r29),%r30
162 LDREG PT_GR29(%r29),%r29
163 .endm
164
165
166
167 .macro def code
168 b intr_save
169 ldi \code, %r8
170 .align 32
171 .endm
172
173
174
175 .macro extint code
176 b intr_extint
177 mfsp %sr7,%r16
178 .align 32
179 .endm
180
181 .import os_hpmc, code
182
183
184 .macro hpmc code
185 nop
186 load32 PA(os_hpmc), %r3
187 bv,n 0(%r3)
188 nop
189 .word 0
190 .word 0
191 .word 0
192 .endm
193
194
195
196
197
198
199
200
201
202 va = r8
203 spc = r24
204
205#ifndef CONFIG_64BIT
206
207
208
209
210
211 .macro itlb_11 code
212
213 mfctl %pcsq, spc
214 b itlb_miss_11
215 mfctl %pcoq, va
216
217 .align 32
218 .endm
219#endif
220
221
222
223
224
225 .macro itlb_20 code
226 mfctl %pcsq, spc
227#ifdef CONFIG_64BIT
228 b itlb_miss_20w
229#else
230 b itlb_miss_20
231#endif
232 mfctl %pcoq, va
233
234 .align 32
235 .endm
236
237#ifndef CONFIG_64BIT
238
239
240
241
242 .macro naitlb_11 code
243
244 mfctl %isr,spc
245 b naitlb_miss_11
246 mfctl %ior,va
247
248 .align 32
249 .endm
250#endif
251
252
253
254
255
256 .macro naitlb_20 code
257
258 mfctl %isr,spc
259#ifdef CONFIG_64BIT
260 b naitlb_miss_20w
261#else
262 b naitlb_miss_20
263#endif
264 mfctl %ior,va
265
266 .align 32
267 .endm
268
269#ifndef CONFIG_64BIT
270
271
272
273
274 .macro dtlb_11 code
275
276 mfctl %isr, spc
277 b dtlb_miss_11
278 mfctl %ior, va
279
280 .align 32
281 .endm
282#endif
283
284
285
286
287
288 .macro dtlb_20 code
289
290 mfctl %isr, spc
291#ifdef CONFIG_64BIT
292 b dtlb_miss_20w
293#else
294 b dtlb_miss_20
295#endif
296 mfctl %ior, va
297
298 .align 32
299 .endm
300
301#ifndef CONFIG_64BIT
302
303
304 .macro nadtlb_11 code
305
306 mfctl %isr,spc
307 b nadtlb_miss_11
308 mfctl %ior,va
309
310 .align 32
311 .endm
312#endif
313
314
315
316 .macro nadtlb_20 code
317
318 mfctl %isr,spc
319#ifdef CONFIG_64BIT
320 b nadtlb_miss_20w
321#else
322 b nadtlb_miss_20
323#endif
324 mfctl %ior,va
325
326 .align 32
327 .endm
328
329#ifndef CONFIG_64BIT
330
331
332
333
334 .macro dbit_11 code
335
336 mfctl %isr,spc
337 b dbit_trap_11
338 mfctl %ior,va
339
340 .align 32
341 .endm
342#endif
343
344
345
346
347
348 .macro dbit_20 code
349
350 mfctl %isr,spc
351#ifdef CONFIG_64BIT
352 b dbit_trap_20w
353#else
354 b dbit_trap_20
355#endif
356 mfctl %ior,va
357
358 .align 32
359 .endm
360
361
362
363
364 .macro space_adjust spc,va,tmp
365#ifdef CONFIG_64BIT
366 extrd,u \spc,63,SPACEID_SHIFT,\tmp
367 depd %r0,63,SPACEID_SHIFT,\spc
368 depd \tmp,31,SPACEID_SHIFT,\va
369#endif
370 .endm
371
372 .import swapper_pg_dir,code
373
374
375
376
377 .macro get_pgd spc,reg
378 ldil L%PA(swapper_pg_dir),\reg
379 ldo R%PA(swapper_pg_dir)(\reg),\reg
380 or,COND(=) %r0,\spc,%r0
381 mfctl %cr25,\reg
382 .endm
383
384
385
386
387
388
389
390
391
392
393
394
395 .macro space_check spc,tmp,fault
396 mfsp %sr7,\tmp
397
398 or,COND(<>) %r0,\spc,%r0
399
400
401 copy \spc,\tmp
402 or,COND(=) %r0,\tmp,%r0
403 cmpb,COND(<>),n \tmp,\spc,\fault
404 .endm
405
406
407
408
409
410
411
412 .macro L2_ptep pmd,pte,index,va,fault
413
414 extru \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index
415#else
416
417 extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
418 #else
419
420 extru \va,31-ASM_PGDIR_SHIFT,32-ASM_PGDIR_SHIFT,\index
421 # else
422 extru \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
423 # endif
424# endif
425#endif
426 dep %r0,31,PAGE_SHIFT,\pmd
427 copy %r0,\pte
428 ldw,s \index(\pmd),\pmd
429 bb,>=,n \pmd,_PxD_PRESENT_BIT,\fault
430 dep %r0,31,PxD_FLAG_SHIFT,\pmd
431 SHLREG \pmd,PxD_VALUE_SHIFT,\pmd
432 extru \va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index
433 dep %r0,31,PAGE_SHIFT,\pmd
434 shladd \index,BITS_PER_PTE_ENTRY,\pmd,\pmd
435 .endm
436
437
438
439
440
441
442
443
444
445
446
447 .macro L3_ptep pgd,pte,index,va,fault
448
449 extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
450 extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
451 ldw,s \index(\pgd),\pgd
452 extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
453 bb,>=,n \pgd,_PxD_PRESENT_BIT,\fault
454 extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
455 shld \pgd,PxD_VALUE_SHIFT,\index
456 extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
457 copy \index,\pgd
458 extrd,u,*<> \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
459 ldo ASM_PGD_PMD_OFFSET(\pgd),\pgd
460#endif
461 L2_ptep \pgd,\pte,\index,\va,\fault
462 .endm
463
464
465 .macro tlb_lock spc,ptp,pte,tmp,tmp1,fault
466#ifdef CONFIG_SMP
46798: cmpib,COND(=),n 0,\spc,2f
468 load_pa_tlb_lock \tmp
4691: LDCW 0(\tmp),\tmp1
470 cmpib,COND(=) 0,\tmp1,1b
471 nop
472 LDREG 0(\ptp),\pte
473 bb,<,n \pte,_PAGE_PRESENT_BIT,3f
474 b \fault
475 stw,ma \spc,0(\tmp)
47699: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP)
477#endif
4782: LDREG 0(\ptp),\pte
479 bb,>=,n \pte,_PAGE_PRESENT_BIT,\fault
4803:
481 .endm
482
483
484 .macro tlb_unlock0 spc,tmp
485#ifdef CONFIG_SMP
48698: or,COND(=) %r0,\spc,%r0
487 stw,ma \spc,0(\tmp)
48899: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP)
489#endif
490 .endm
491
492
493 .macro tlb_unlock1 spc,tmp
494#ifdef CONFIG_SMP
49598: load_pa_tlb_lock \tmp
49699: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP)
497 tlb_unlock0 \spc,\tmp
498#endif
499 .endm
500
501
502
503 .macro update_accessed ptp,pte,tmp,tmp1
504 ldi _PAGE_ACCESSED,\tmp1
505 or \tmp1,\pte,\tmp
506 and,COND(<>) \tmp1,\pte,%r0
507 STREG \tmp,0(\ptp)
508 .endm
509
510
511
512 .macro update_dirty ptp,pte,tmp
513 ldi _PAGE_ACCESSED|_PAGE_DIRTY,\tmp
514 or \tmp,\pte,\pte
515 STREG \pte,0(\ptp)
516 .endm
517
518
519
520
521
522
523
524 #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
525 #define PAGE_ADD_HUGE_SHIFT (REAL_HPAGE_SHIFT-12)
526
527
528 .macro convert_for_tlb_insert20 pte,tmp
529#ifdef CONFIG_HUGETLB_PAGE
530 copy \pte,\tmp
531 extrd,u \tmp,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
532 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
533
534 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
535 (63-58)+PAGE_ADD_SHIFT,\pte
536 extrd,u,*= \tmp,_PAGE_HPAGE_BIT+32,1,%r0
537 depdi _HUGE_PAGE_SIZE_ENCODING_DEFAULT,63,\
538 (63-58)+PAGE_ADD_HUGE_SHIFT,\pte
539#else
540 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
541 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
542 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
543 (63-58)+PAGE_ADD_SHIFT,\pte
544#endif
545 .endm
546
547
548
549 .macro make_insert_tlb spc,pte,prot,tmp
550 space_to_prot \spc \prot
551
552
553
554
555
556
557
558
559
560
561
562
563 depd \pte,8,7,\prot
564
565
566
567
568 extrd,u,*= \pte,_PAGE_USER_BIT+32,1,%r0
569 depdi 7,11,3,\prot
570
571
572
573 extrd,u,*= \pte,_PAGE_GATEWAY_BIT+32,1,%r0
574 depd %r0,11,2,\prot
575
576
577
578
579
580
581
582 extrd,u,*= \pte,_PAGE_NO_CACHE_BIT+32,1,%r0
583 depdi 1,12,1,\prot
584
585
586 convert_for_tlb_insert20 \pte \tmp
587 .endm
588
589
590
591
592 .macro make_insert_tlb_11 spc,pte,prot
593 zdep \spc,30,15,\prot
594 dep \pte,8,7,\prot
595 extru,= \pte,_PAGE_NO_CACHE_BIT,1,%r0
596 depi 1,12,1,\prot
597 extru,= \pte,_PAGE_USER_BIT,1,%r0
598 depi 7,11,3,\prot
599 extru,= \pte,_PAGE_GATEWAY_BIT,1,%r0
600 depi 0,11,2,\prot
601
602
603
604 depi 0,31,ASM_PFN_PTE_SHIFT,\pte
605 SHRREG \pte,(ASM_PFN_PTE_SHIFT-(31-26)),\pte
606 .endm
607
608
609
610
611
612 .macro f_extend pte,tmp
613 extrd,s \pte,42,4,\tmp
614 addi,<> 1,\tmp,%r0
615 extrd,s \pte,63,25,\pte
616 .endm
617
618
619
620
621
622
623
624
625
626 .macro do_alias spc,tmp,tmp1,va,pte,prot,fault,patype
627 cmpib,COND(<>),n 0,\spc,\fault
628 ldil L%(TMPALIAS_MAP_START),\tmp
629
630
631
632 depdi 0,31,32,\tmp
633#endif
634 copy \va,\tmp1
635 depi 0,31,23,\tmp1
636 cmpb,COND(<>),n \tmp,\tmp1,\fault
637 mfctl %cr19,\tmp
638
639 extrw,u \tmp,5,6,\tmp
640
641
642
643
644
645
646
647 ldi (_PAGE_REFTRAP|_PAGE_READ|_PAGE_WRITE),\prot
648
649
650
651
652
653 cmpiclr,= 0x01,\tmp,%r0
654 ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot
655.ifc \patype,20
656 depd,z \prot,8,7,\prot
657.else
658.ifc \patype,11
659 depw,z \prot,8,7,\prot
660.else
661 .error "undefined PA type to do_alias"
662.endif
663.endif
664
665
666
667
668#ifdef CONFIG_64BIT
669 extrd,u,*= \va,41,1,%r0
670#else
671 extrw,u,= \va,9,1,%r0
672#endif
673 or,COND(tr) %r23,%r0,\pte
674 or %r26,%r0,\pte
675 .endm
676
677
678
679
680
681
682
683 .section .text.hot
684 .align 2048
685
686ENTRY(fault_vector_20)
687
688 .ascii "cows can fly"
689 .byte 0
690 .align 32
691
692 hpmc 1
693 def 2
694 def 3
695 extint 4
696 def 5
697 itlb_20 PARISC_ITLB_TRAP
698 def 7
699 def 8
700 def 9
701 def 10
702 def 11
703 def 12
704 def 13
705 def 14
706 dtlb_20 15
707 naitlb_20 16
708 nadtlb_20 17
709 def 18
710 def 19
711 dbit_20 20
712 def 21
713 def 22
714 def 23
715 def 24
716 def 25
717 def 26
718 def 27
719 def 28
720 def 29
721 def 30
722 def 31
723END(fault_vector_20)
724
725#ifndef CONFIG_64BIT
726
727 .align 2048
728
729ENTRY(fault_vector_11)
730
731 .ascii "cows can fly"
732 .byte 0
733 .align 32
734
735 hpmc 1
736 def 2
737 def 3
738 extint 4
739 def 5
740 itlb_11 PARISC_ITLB_TRAP
741 def 7
742 def 8
743 def 9
744 def 10
745 def 11
746 def 12
747 def 13
748 def 14
749 dtlb_11 15
750 naitlb_11 16
751 nadtlb_11 17
752 def 18
753 def 19
754 dbit_11 20
755 def 21
756 def 22
757 def 23
758 def 24
759 def 25
760 def 26
761 def 27
762 def 28
763 def 29
764 def 30
765 def 31
766END(fault_vector_11)
767
768#endif
769
770 .align PAGE_SIZE
771
772 .import handle_interruption,code
773 .import do_cpu_irq_mask,code
774
775
776
777
778
779
780
781ENTRY(ret_from_kernel_thread)
782
783 BL schedule_tail, %r2
784 nop
785
786 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
787 LDREG TASK_PT_GR25(%r1), %r26
788#ifdef CONFIG_64BIT
789 LDREG TASK_PT_GR27(%r1), %r27
790#endif
791 LDREG TASK_PT_GR26(%r1), %r1
792 ble 0(%sr7, %r1)
793 copy %r31, %r2
794 b finish_child_return
795 nop
796END(ret_from_kernel_thread)
797
798
799
800
801
802
803
804ENTRY_CFI(_switch_to)
805 STREG %r2, -RP_OFFSET(%r30)
806
807 callee_save_float
808 callee_save
809
810 load32 _switch_to_ret, %r2
811
812 STREG %r2, TASK_PT_KPC(%r26)
813 LDREG TASK_PT_KPC(%r25), %r2
814
815 STREG %r30, TASK_PT_KSP(%r26)
816 LDREG TASK_PT_KSP(%r25), %r30
817 LDREG TASK_THREAD_INFO(%r25), %r25
818 bv %r0(%r2)
819 mtctl %r25,%cr30
820
821ENTRY(_switch_to_ret)
822 mtctl %r0, %cr0
823 callee_rest
824 callee_rest_float
825
826 LDREG -RP_OFFSET(%r30), %r2
827 bv %r0(%r2)
828 copy %r26, %r28
829ENDPROC_CFI(_switch_to)
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845 .align PAGE_SIZE
846
847ENTRY_CFI(syscall_exit_rfi)
848 mfctl %cr30,%r16
849 LDREG TI_TASK(%r16), %r16
850 ldo TASK_REGS(%r16),%r16
851
852
853
854 LDREG PT_IAOQ0(%r16),%r19
855 depi 3,31,2,%r19
856 STREG %r19,PT_IAOQ0(%r16)
857 LDREG PT_IAOQ1(%r16),%r19
858 depi 3,31,2,%r19
859 STREG %r19,PT_IAOQ1(%r16)
860 LDREG PT_PSW(%r16),%r19
861 load32 USER_PSW_MASK,%r1
862#ifdef CONFIG_64BIT
863 load32 USER_PSW_HI_MASK,%r20
864 depd %r20,31,32,%r1
865#endif
866 and %r19,%r1,%r19
867 load32 USER_PSW,%r1
868 or %r19,%r1,%r19
869 STREG %r19,PT_PSW(%r16)
870
871
872
873
874
875
876
877
878
879
880
881 STREG %r0,PT_SR2(%r16)
882 mfsp %sr3,%r19
883 STREG %r19,PT_SR0(%r16)
884 STREG %r19,PT_SR1(%r16)
885 STREG %r19,PT_SR3(%r16)
886 STREG %r19,PT_SR4(%r16)
887 STREG %r19,PT_SR5(%r16)
888 STREG %r19,PT_SR6(%r16)
889 STREG %r19,PT_SR7(%r16)
890
891ENTRY(intr_return)
892
893 mfctl %cr30,%r1
894 LDREG TI_FLAGS(%r1),%r19
895 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched
896
897 .import do_notify_resume,code
898intr_check_sig:
899
900 mfctl %cr30,%r1
901 LDREG TI_FLAGS(%r1),%r19
902 ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r20
903 and,COND(<>) %r19, %r20, %r0
904 b,n intr_restore
905
906
907
908
909
910
911
912
913 LDREG PT_IASQ0(%r16), %r20
914 cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore
915 LDREG PT_IASQ1(%r16), %r20
916 cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore
917
918
919
920
921 ssm PSW_SM_I, %r0
922
923 copy %r0, %r25
924#ifdef CONFIG_64BIT
925 ldo -16(%r30),%r29
926#endif
927
928 BL do_notify_resume,%r2
929 copy %r16, %r26
930
931 b,n intr_check_sig
932
933intr_restore:
934 copy %r16,%r29
935 ldo PT_FR31(%r29),%r1
936 rest_fp %r1
937 rest_general %r29
938
939
940 pcxt_ssm_bug
941 rsm PSW_SM_QUIET,%r0
942 tophys_r1 %r29
943
944
945
946
947 rest_specials %r29
948
949
950
951
952 rest_stack
953
954 rfi
955 nop
956
957#ifndef CONFIG_PREEMPT
958# define intr_do_preempt intr_restore
959#endif
960
961 .import schedule,code
962intr_do_resched:
963
964
965
966
967 LDREG PT_IASQ0(%r16), %r20
968 cmpib,COND(=) 0, %r20, intr_do_preempt
969 nop
970 LDREG PT_IASQ1(%r16), %r20
971 cmpib,COND(=) 0, %r20, intr_do_preempt
972 nop
973
974
975
976 ssm PSW_SM_I, %r0
977
978#ifdef CONFIG_64BIT
979 ldo -16(%r30),%r29
980#endif
981
982 ldil L%intr_check_sig, %r2
983#ifndef CONFIG_64BIT
984 b schedule
985#else
986 load32 schedule, %r20
987 bv %r0(%r20)
988#endif
989 ldo R%intr_check_sig(%r2), %r2
990
991
992
993
994
995
996#ifdef CONFIG_PREEMPT
997 .import preempt_schedule_irq,code
998intr_do_preempt:
999 rsm PSW_SM_I, %r0
1000
1001
1002 mfctl %cr30, %r1
1003 LDREG TI_PRE_COUNT(%r1), %r19
1004 cmpib,COND(<>) 0, %r19, intr_restore
1005 nop
1006
1007
1008 LDREG PT_PSW(%r16), %r20
1009 bb,<,n %r20, 31 - PSW_SM_I, intr_restore
1010 nop
1011
1012 BL preempt_schedule_irq, %r2
1013 nop
1014
1015 b,n intr_restore
1016#endif
1017
1018
1019
1020
1021
1022intr_extint:
1023 cmpib,COND(=),n 0,%r16,1f
1024
1025 get_stack_use_cr30
1026 b,n 2f
1027
10281:
1029 get_stack_use_r30
10302:
1031 save_specials %r29
1032 virt_map
1033 save_general %r29
1034
1035 ldo PT_FR0(%r29), %r24
1036 save_fp %r24
1037
1038 loadgp
1039
1040 copy %r29, %r26
1041 copy %r29, %r16
1042
1043 ldil L%intr_return, %r2
1044
1045#ifdef CONFIG_64BIT
1046 ldo -16(%r30),%r29
1047#endif
1048
1049 b do_cpu_irq_mask
1050 ldo R%intr_return(%r2), %r2
1051ENDPROC_CFI(syscall_exit_rfi)
1052
1053
1054
1055
1056ENTRY_CFI(intr_save)
1057 mfsp %sr7,%r16
1058 cmpib,COND(=),n 0,%r16,1f
1059 get_stack_use_cr30
1060 b 2f
1061 copy %r8,%r26
1062
10631:
1064 get_stack_use_r30
1065 copy %r8,%r26
1066
10672:
1068 save_specials %r29
1069
1070
1071 cmpib,COND(=),n PARISC_ITLB_TRAP,%r26,skip_save_ior
1072
1073
1074 mfctl %isr, %r16
1075 nop
1076 mfctl %ior, %r17
1077
1078
1079#ifdef CONFIG_64BIT
1080
1081
1082
1083
1084
1085 extrd,u,*<> %r8,PSW_W_BIT,1,%r0
1086 depdi 0,1,2,%r17
1087
1088
1089 space_adjust %r16,%r17,%r1
1090#endif
1091 STREG %r16, PT_ISR(%r29)
1092 STREG %r17, PT_IOR(%r29)
1093
1094
1095
1096 b,n intr_save2
1097
1098skip_save_ior:
1099
1100
1101
1102
1103 extrd,u,* %r8,PSW_W_BIT,1,%r1
1104 cmpib,COND(=),n 1,%r1,intr_save2
1105 LDREG PT_IASQ0(%r29), %r16
1106 LDREG PT_IAOQ0(%r29), %r17
1107
1108 space_adjust %r16,%r17,%r1
1109 STREG %r16, PT_IASQ0(%r29)
1110 STREG %r17, PT_IAOQ0(%r29)
1111#else
1112skip_save_ior:
1113#endif
1114
1115intr_save2:
1116 virt_map
1117 save_general %r29
1118
1119 ldo PT_FR0(%r29), %r25
1120 save_fp %r25
1121
1122 loadgp
1123
1124 copy %r29, %r25
1125#ifdef CONFIG_64BIT
1126 ldo -16(%r30),%r29
1127#endif
1128
1129 ldil L%intr_check_sig, %r2
1130 copy %r25, %r16
1131
1132 b handle_interruption
1133 ldo R%intr_check_sig(%r2), %r2
1134ENDPROC_CFI(intr_save)
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156 t0 = r1
1157 va = r8
1158 t1 = r9
1159 pte = r16
1160 prot = r17
1161 spc = r24
1162 ptp = r25
1163
1164#ifdef CONFIG_64BIT
1165
1166dtlb_miss_20w:
1167 space_adjust spc,va,t0
1168 get_pgd spc,ptp
1169 space_check spc,t0,dtlb_fault
1170
1171 L3_ptep ptp,pte,t0,va,dtlb_check_alias_20w
1172
1173 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w
1174 update_accessed ptp,pte,t0,t1
1175
1176 make_insert_tlb spc,pte,prot,t1
1177
1178 idtlbt pte,prot
1179
1180 tlb_unlock1 spc,t0
1181 rfir
1182 nop
1183
1184dtlb_check_alias_20w:
1185 do_alias spc,t0,t1,va,pte,prot,dtlb_fault,20
1186
1187 idtlbt pte,prot
1188
1189 rfir
1190 nop
1191
1192nadtlb_miss_20w:
1193 space_adjust spc,va,t0
1194 get_pgd spc,ptp
1195 space_check spc,t0,nadtlb_fault
1196
1197 L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w
1198
1199 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w
1200 update_accessed ptp,pte,t0,t1
1201
1202 make_insert_tlb spc,pte,prot,t1
1203
1204 idtlbt pte,prot
1205
1206 tlb_unlock1 spc,t0
1207 rfir
1208 nop
1209
1210nadtlb_check_alias_20w:
1211 do_alias spc,t0,t1,va,pte,prot,nadtlb_emulate,20
1212
1213 idtlbt pte,prot
1214
1215 rfir
1216 nop
1217
1218#else
1219
1220dtlb_miss_11:
1221 get_pgd spc,ptp
1222
1223 space_check spc,t0,dtlb_fault
1224
1225 L2_ptep ptp,pte,t0,va,dtlb_check_alias_11
1226
1227 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_11
1228 update_accessed ptp,pte,t0,t1
1229
1230 make_insert_tlb_11 spc,pte,prot
1231
1232 mfsp %sr1,t1
1233 mtsp spc,%sr1
1234
1235 idtlba pte,(%sr1,va)
1236 idtlbp prot,(%sr1,va)
1237
1238 mtsp t1, %sr1
1239
1240 tlb_unlock1 spc,t0
1241 rfir
1242 nop
1243
1244dtlb_check_alias_11:
1245 do_alias spc,t0,t1,va,pte,prot,dtlb_fault,11
1246
1247 idtlba pte,(va)
1248 idtlbp prot,(va)
1249
1250 rfir
1251 nop
1252
1253nadtlb_miss_11:
1254 get_pgd spc,ptp
1255
1256 space_check spc,t0,nadtlb_fault
1257
1258 L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11
1259
1260 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_11
1261 update_accessed ptp,pte,t0,t1
1262
1263 make_insert_tlb_11 spc,pte,prot
1264
1265 mfsp %sr1,t1
1266 mtsp spc,%sr1
1267
1268 idtlba pte,(%sr1,va)
1269 idtlbp prot,(%sr1,va)
1270
1271 mtsp t1, %sr1
1272
1273 tlb_unlock1 spc,t0
1274 rfir
1275 nop
1276
1277nadtlb_check_alias_11:
1278 do_alias spc,t0,t1,va,pte,prot,nadtlb_emulate,11
1279
1280 idtlba pte,(va)
1281 idtlbp prot,(va)
1282
1283 rfir
1284 nop
1285
1286dtlb_miss_20:
1287 space_adjust spc,va,t0
1288 get_pgd spc,ptp
1289 space_check spc,t0,dtlb_fault
1290
1291 L2_ptep ptp,pte,t0,va,dtlb_check_alias_20
1292
1293 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20
1294 update_accessed ptp,pte,t0,t1
1295
1296 make_insert_tlb spc,pte,prot,t1
1297
1298 f_extend pte,t1
1299
1300 idtlbt pte,prot
1301
1302 tlb_unlock1 spc,t0
1303 rfir
1304 nop
1305
1306dtlb_check_alias_20:
1307 do_alias spc,t0,t1,va,pte,prot,dtlb_fault,20
1308
1309 idtlbt pte,prot
1310
1311 rfir
1312 nop
1313
1314nadtlb_miss_20:
1315 get_pgd spc,ptp
1316
1317 space_check spc,t0,nadtlb_fault
1318
1319 L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20
1320
1321 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20
1322 update_accessed ptp,pte,t0,t1
1323
1324 make_insert_tlb spc,pte,prot,t1
1325
1326 f_extend pte,t1
1327
1328 idtlbt pte,prot
1329
1330 tlb_unlock1 spc,t0
1331 rfir
1332 nop
1333
1334nadtlb_check_alias_20:
1335 do_alias spc,t0,t1,va,pte,prot,nadtlb_emulate,20
1336
1337 idtlbt pte,prot
1338
1339 rfir
1340 nop
1341
1342#endif
1343
1344nadtlb_emulate:
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361 mfctl %cr19,%r9
1362
1363
1364
1365
1366
1367 ldi 0x280,%r16
1368 and %r9,%r16,%r17
1369 cmpb,<>,n %r16,%r17,nadtlb_probe_check
1370 bb,>=,n %r9,26,nadtlb_nullify
1371 BL get_register,%r25
1372 extrw,u %r9,15,5,%r8
1373 cmpib,COND(=),n -1,%r1,nadtlb_fault
1374 copy %r1,%r24
1375 BL get_register,%r25
1376 extrw,u %r9,10,5,%r8
1377 cmpib,COND(=),n -1,%r1,nadtlb_fault
1378 BL set_register,%r25
1379 add,l %r1,%r24,%r1
1380
1381nadtlb_nullify:
1382 mfctl %ipsw,%r8
1383 ldil L%PSW_N,%r9
1384 or %r8,%r9,%r8
1385 mtctl %r8,%ipsw
1386
1387 rfir
1388 nop
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403nadtlb_probe_check:
1404 ldi 0x80,%r16
1405 and %r9,%r16,%r17
1406 cmpb,<>,n %r16,%r17,nadtlb_fault
1407 BL get_register,%r25
1408 extrw,u %r9,31,5,%r8
1409 cmpib,COND(=),n -1,%r1,nadtlb_fault
1410 BL set_register,%r25
1411 copy %r0,%r1
1412 b nadtlb_nullify
1413 nop
1414
1415
1416#ifdef CONFIG_64BIT
1417itlb_miss_20w:
1418
1419
1420
1421
1422
1423
1424 space_adjust spc,va,t0
1425 get_pgd spc,ptp
1426 space_check spc,t0,itlb_fault
1427
1428 L3_ptep ptp,pte,t0,va,itlb_fault
1429
1430 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
1431 update_accessed ptp,pte,t0,t1
1432
1433 make_insert_tlb spc,pte,prot,t1
1434
1435 iitlbt pte,prot
1436
1437 tlb_unlock1 spc,t0
1438 rfir
1439 nop
1440
1441naitlb_miss_20w:
1442
1443
1444
1445
1446
1447
1448 space_adjust spc,va,t0
1449 get_pgd spc,ptp
1450 space_check spc,t0,naitlb_fault
1451
1452 L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w
1453
1454 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w
1455 update_accessed ptp,pte,t0,t1
1456
1457 make_insert_tlb spc,pte,prot,t1
1458
1459 iitlbt pte,prot
1460
1461 tlb_unlock1 spc,t0
1462 rfir
1463 nop
1464
1465naitlb_check_alias_20w:
1466 do_alias spc,t0,t1,va,pte,prot,naitlb_fault,20
1467
1468 iitlbt pte,prot
1469
1470 rfir
1471 nop
1472
1473#else
1474
1475itlb_miss_11:
1476 get_pgd spc,ptp
1477
1478 space_check spc,t0,itlb_fault
1479
1480 L2_ptep ptp,pte,t0,va,itlb_fault
1481
1482 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
1483 update_accessed ptp,pte,t0,t1
1484
1485 make_insert_tlb_11 spc,pte,prot
1486
1487 mfsp %sr1,t1
1488 mtsp spc,%sr1
1489
1490 iitlba pte,(%sr1,va)
1491 iitlbp prot,(%sr1,va)
1492
1493 mtsp t1, %sr1
1494
1495 tlb_unlock1 spc,t0
1496 rfir
1497 nop
1498
1499naitlb_miss_11:
1500 get_pgd spc,ptp
1501
1502 space_check spc,t0,naitlb_fault
1503
1504 L2_ptep ptp,pte,t0,va,naitlb_check_alias_11
1505
1506 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_11
1507 update_accessed ptp,pte,t0,t1
1508
1509 make_insert_tlb_11 spc,pte,prot
1510
1511 mfsp %sr1,t1
1512 mtsp spc,%sr1
1513
1514 iitlba pte,(%sr1,va)
1515 iitlbp prot,(%sr1,va)
1516
1517 mtsp t1, %sr1
1518
1519 tlb_unlock1 spc,t0
1520 rfir
1521 nop
1522
1523naitlb_check_alias_11:
1524 do_alias spc,t0,t1,va,pte,prot,itlb_fault,11
1525
1526 iitlba pte,(%sr0, va)
1527 iitlbp prot,(%sr0, va)
1528
1529 rfir
1530 nop
1531
1532
1533itlb_miss_20:
1534 get_pgd spc,ptp
1535
1536 space_check spc,t0,itlb_fault
1537
1538 L2_ptep ptp,pte,t0,va,itlb_fault
1539
1540 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
1541 update_accessed ptp,pte,t0,t1
1542
1543 make_insert_tlb spc,pte,prot,t1
1544
1545 f_extend pte,t1
1546
1547 iitlbt pte,prot
1548
1549 tlb_unlock1 spc,t0
1550 rfir
1551 nop
1552
1553naitlb_miss_20:
1554 get_pgd spc,ptp
1555
1556 space_check spc,t0,naitlb_fault
1557
1558 L2_ptep ptp,pte,t0,va,naitlb_check_alias_20
1559
1560 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20
1561 update_accessed ptp,pte,t0,t1
1562
1563 make_insert_tlb spc,pte,prot,t1
1564
1565 f_extend pte,t1
1566
1567 iitlbt pte,prot
1568
1569 tlb_unlock1 spc,t0
1570 rfir
1571 nop
1572
1573naitlb_check_alias_20:
1574 do_alias spc,t0,t1,va,pte,prot,naitlb_fault,20
1575
1576 iitlbt pte,prot
1577
1578 rfir
1579 nop
1580
1581#endif
1582
1583#ifdef CONFIG_64BIT
1584
1585dbit_trap_20w:
1586 space_adjust spc,va,t0
1587 get_pgd spc,ptp
1588 space_check spc,t0,dbit_fault
1589
1590 L3_ptep ptp,pte,t0,va,dbit_fault
1591
1592 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
1593 update_dirty ptp,pte,t1
1594
1595 make_insert_tlb spc,pte,prot,t1
1596
1597 idtlbt pte,prot
1598
1599 tlb_unlock0 spc,t0
1600 rfir
1601 nop
1602#else
1603
1604dbit_trap_11:
1605
1606 get_pgd spc,ptp
1607
1608 space_check spc,t0,dbit_fault
1609
1610 L2_ptep ptp,pte,t0,va,dbit_fault
1611
1612 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
1613 update_dirty ptp,pte,t1
1614
1615 make_insert_tlb_11 spc,pte,prot
1616
1617 mfsp %sr1,t1
1618 mtsp spc,%sr1
1619
1620 idtlba pte,(%sr1,va)
1621 idtlbp prot,(%sr1,va)
1622
1623 mtsp t1, %sr1
1624
1625 tlb_unlock0 spc,t0
1626 rfir
1627 nop
1628
1629dbit_trap_20:
1630 get_pgd spc,ptp
1631
1632 space_check spc,t0,dbit_fault
1633
1634 L2_ptep ptp,pte,t0,va,dbit_fault
1635
1636 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
1637 update_dirty ptp,pte,t1
1638
1639 make_insert_tlb spc,pte,prot,t1
1640
1641 f_extend pte,t1
1642
1643 idtlbt pte,prot
1644
1645 tlb_unlock0 spc,t0
1646 rfir
1647 nop
1648#endif
1649
1650 .import handle_interruption,code
1651
1652kernel_bad_space:
1653 b intr_save
1654 ldi 31,%r8
1655
1656dbit_fault:
1657 b intr_save
1658 ldi 20,%r8
1659
1660itlb_fault:
1661 b intr_save
1662 ldi PARISC_ITLB_TRAP,%r8
1663
1664nadtlb_fault:
1665 b intr_save
1666 ldi 17,%r8
1667
1668naitlb_fault:
1669 b intr_save
1670 ldi 16,%r8
1671
1672dtlb_fault:
1673 b intr_save
1674 ldi 15,%r8
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698 .macro reg_save regs
1699 STREG %r3, PT_GR3(\regs)
1700 STREG %r4, PT_GR4(\regs)
1701 STREG %r5, PT_GR5(\regs)
1702 STREG %r6, PT_GR6(\regs)
1703 STREG %r7, PT_GR7(\regs)
1704 STREG %r8, PT_GR8(\regs)
1705 STREG %r9, PT_GR9(\regs)
1706 STREG %r10,PT_GR10(\regs)
1707 STREG %r11,PT_GR11(\regs)
1708 STREG %r12,PT_GR12(\regs)
1709 STREG %r13,PT_GR13(\regs)
1710 STREG %r14,PT_GR14(\regs)
1711 STREG %r15,PT_GR15(\regs)
1712 STREG %r16,PT_GR16(\regs)
1713 STREG %r17,PT_GR17(\regs)
1714 STREG %r18,PT_GR18(\regs)
1715 .endm
1716
1717 .macro reg_restore regs
1718 LDREG PT_GR3(\regs), %r3
1719 LDREG PT_GR4(\regs), %r4
1720 LDREG PT_GR5(\regs), %r5
1721 LDREG PT_GR6(\regs), %r6
1722 LDREG PT_GR7(\regs), %r7
1723 LDREG PT_GR8(\regs), %r8
1724 LDREG PT_GR9(\regs), %r9
1725 LDREG PT_GR10(\regs),%r10
1726 LDREG PT_GR11(\regs),%r11
1727 LDREG PT_GR12(\regs),%r12
1728 LDREG PT_GR13(\regs),%r13
1729 LDREG PT_GR14(\regs),%r14
1730 LDREG PT_GR15(\regs),%r15
1731 LDREG PT_GR16(\regs),%r16
1732 LDREG PT_GR17(\regs),%r17
1733 LDREG PT_GR18(\regs),%r18
1734 .endm
1735
1736 .macro fork_like name
1737ENTRY_CFI(sys_\name\()_wrapper)
1738 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1739 ldo TASK_REGS(%r1),%r1
1740 reg_save %r1
1741 mfctl %cr27, %r28
1742 ldil L%sys_\name, %r31
1743 be R%sys_\name(%sr4,%r31)
1744 STREG %r28, PT_CR27(%r1)
1745ENDPROC_CFI(sys_\name\()_wrapper)
1746 .endm
1747
1748fork_like clone
1749fork_like fork
1750fork_like vfork
1751
1752
1753ENTRY(child_return)
1754 BL schedule_tail, %r2
1755 nop
1756finish_child_return:
1757 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1758 ldo TASK_REGS(%r1),%r1
1759
1760 LDREG PT_CR27(%r1), %r3
1761 mtctl %r3, %cr27
1762 reg_restore %r1
1763 b syscall_exit
1764 copy %r0,%r28
1765END(child_return)
1766
1767ENTRY_CFI(sys_rt_sigreturn_wrapper)
1768 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26
1769 ldo TASK_REGS(%r26),%r26
1770
1771 STREG %r2, -RP_OFFSET(%r30)
1772#ifdef CONFIG_64BIT
1773 ldo FRAME_SIZE(%r30), %r30
1774 BL sys_rt_sigreturn,%r2
1775 ldo -16(%r30),%r29
1776#else
1777 BL sys_rt_sigreturn,%r2
1778 ldo FRAME_SIZE(%r30), %r30
1779#endif
1780
1781 ldo -FRAME_SIZE(%r30), %r30
1782 LDREG -RP_OFFSET(%r30), %r2
1783
1784
1785 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1786 ldo TASK_REGS(%r1),%r1
1787 reg_restore %r1
1788
1789
1790
1791
1792
1793 bv %r0(%r2)
1794 LDREG PT_GR28(%r1),%r28
1795ENDPROC_CFI(sys_rt_sigreturn_wrapper)
1796
1797ENTRY(syscall_exit)
1798
1799
1800
1801
1802
1803
1804
1805 mfctl %cr30, %r1
1806 LDREG TI_TASK(%r1),%r1
1807 STREG %r28,TASK_PT_GR28(%r1)
1808
1809
1810
1811
1812 loadgp
1813
1814syscall_check_resched:
1815
1816
1817
1818 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
1819 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched
1820
1821 .import do_signal,code
1822syscall_check_sig:
1823 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
1824 ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r26
1825 and,COND(<>) %r19, %r26, %r0
1826 b,n syscall_restore
1827
1828syscall_do_signal:
1829
1830
1831
1832
1833
1834 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1835 ldo TASK_REGS(%r1), %r26
1836 reg_save %r26
1837
1838#ifdef CONFIG_64BIT
1839 ldo -16(%r30),%r29
1840#endif
1841
1842 BL do_notify_resume,%r2
1843 ldi 1, %r25
1844
1845 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1846 ldo TASK_REGS(%r1), %r20
1847 reg_restore %r20
1848
1849 b,n syscall_check_sig
1850
1851syscall_restore:
1852 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1853
1854
1855 ldw TASK_FLAGS(%r1),%r19
1856 ldi _TIF_SYSCALL_TRACE_MASK,%r2
1857 and,COND(=) %r19,%r2,%r0
1858 b,n syscall_restore_rfi
1859
1860 ldo TASK_PT_FR31(%r1),%r19
1861 rest_fp %r19
1862
1863 LDREG TASK_PT_SAR(%r1),%r19
1864 mtsar %r19
1865
1866 LDREG TASK_PT_GR2(%r1),%r2
1867 LDREG TASK_PT_GR19(%r1),%r19
1868 LDREG TASK_PT_GR20(%r1),%r20
1869 LDREG TASK_PT_GR21(%r1),%r21
1870 LDREG TASK_PT_GR22(%r1),%r22
1871 LDREG TASK_PT_GR23(%r1),%r23
1872 LDREG TASK_PT_GR24(%r1),%r24
1873 LDREG TASK_PT_GR25(%r1),%r25
1874 LDREG TASK_PT_GR26(%r1),%r26
1875 LDREG TASK_PT_GR27(%r1),%r27
1876 LDREG TASK_PT_GR28(%r1),%r28
1877 LDREG TASK_PT_GR29(%r1),%r29
1878 LDREG TASK_PT_GR31(%r1),%r31
1879
1880
1881 LDREG TASK_PT_GR30(%r1),%r1
1882 rsm PSW_SM_I, %r0
1883 copy %r1,%r30
1884 mfsp %sr3,%r1
1885 mtsp %r1,%sr7
1886 ssm PSW_SM_I, %r0
1887
1888
1889 mtsp %r0,%sr2
1890 mtsp %r1,%sr4
1891 mtsp %r1,%sr5
1892 mtsp %r1,%sr6
1893
1894 depi 3,31,2,%r31
1895
1896#ifdef CONFIG_64BIT
1897
1898
1899
1900
1901 extrd,u,*<> %r30,63,1,%r1
1902 rsm PSW_SM_W, %r0
1903
1904 xor %r30,%r1,%r30
1905#endif
1906 be,n 0(%sr3,%r31)
1907
1908
1909
1910
1911
1912
1913syscall_restore_rfi:
1914 ldo -1(%r0),%r2
1915 mtctl %r2,%cr0
1916 LDREG TASK_PT_PSW(%r1),%r2
1917 ldi 0x0b,%r20
1918 depi -1,13,1,%r20
1919
1920
1921
1922
1923
1924
1925 extru,= %r19,TIF_SINGLESTEP_PA_BIT,1,%r0
1926 depi -1,27,1,%r20
1927
1928
1929 extru,= %r19,TIF_BLOCKSTEP_PA_BIT,1,%r0
1930 depi -1,7,1,%r20
1931
1932 STREG %r20,TASK_PT_PSW(%r1)
1933
1934
1935
1936 mfsp %sr3,%r25
1937 STREG %r25,TASK_PT_SR3(%r1)
1938 STREG %r25,TASK_PT_SR4(%r1)
1939 STREG %r25,TASK_PT_SR5(%r1)
1940 STREG %r25,TASK_PT_SR6(%r1)
1941 STREG %r25,TASK_PT_SR7(%r1)
1942 STREG %r25,TASK_PT_IASQ0(%r1)
1943 STREG %r25,TASK_PT_IASQ1(%r1)
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954 bb,< %r2,30,pt_regs_ok
1955 ldo TASK_REGS(%r1),%r25
1956 reg_save %r25
1957
1958
1959 mfsp %sr0,%r2
1960 STREG %r2,TASK_PT_SR0(%r1)
1961
1962
1963 mfsp %sr1,%r2
1964 STREG %r2,TASK_PT_SR1(%r1)
1965
1966
1967 STREG %r0,TASK_PT_SR2(%r1)
1968
1969 LDREG TASK_PT_GR31(%r1),%r2
1970 depi 3,31,2,%r2
1971 STREG %r2,TASK_PT_IAOQ0(%r1)
1972 ldo 4(%r2),%r2
1973 STREG %r2,TASK_PT_IAOQ1(%r1)
1974 b intr_restore
1975 copy %r25,%r16
1976
1977pt_regs_ok:
1978 LDREG TASK_PT_IAOQ0(%r1),%r2
1979 depi 3,31,2,%r2
1980 STREG %r2,TASK_PT_IAOQ0(%r1)
1981 LDREG TASK_PT_IAOQ1(%r1),%r2
1982 depi 3,31,2,%r2
1983 STREG %r2,TASK_PT_IAOQ1(%r1)
1984 b intr_restore
1985 copy %r25,%r16
1986
1987syscall_do_resched:
1988 load32 syscall_check_resched,%r2
1989 load32 schedule,%r19
1990 bv %r0(%r19)
1991#ifdef CONFIG_64BIT
1992 ldo -16(%r30),%r29
1993#else
1994 nop
1995#endif
1996END(syscall_exit)
1997
1998
1999#ifdef CONFIG_FUNCTION_TRACER
2000
2001 .import ftrace_function_trampoline,code
2002 .align L1_CACHE_BYTES
2003ENTRY_CFI(mcount, caller)
2004_mcount:
2005 .export _mcount,data
2006
2007
2008
2009
2010
2011
2012 b ftrace_function_trampoline
2013 copy %r3, %arg2
2014ftrace_stub:
2015 .globl ftrace_stub
2016 .type ftrace_stub, @function
2017#ifdef CONFIG_64BIT
2018 bve (%rp)
2019#else
2020 bv %r0(%rp)
2021#endif
2022 nop
2023#ifdef CONFIG_64BIT
2024 .dword mcount
2025 .dword 0
2026#endif
2027ENDPROC_CFI(mcount)
2028
2029#ifdef CONFIG_FUNCTION_GRAPH_TRACER
2030 .align 8
2031ENTRY_CFI(return_to_handler, caller,frame=FRAME_SIZE)
2032 .export parisc_return_to_handler,data
2033parisc_return_to_handler:
2034 copy %r3,%r1
2035 STREG %r0,-RP_OFFSET(%sp)
2036 copy %sp,%r3
2037 STREGM %r1,FRAME_SIZE(%sp)
2038 STREG %ret0,8(%r3)
2039 STREG %ret1,16(%r3)
2040
2041#ifdef CONFIG_64BIT
2042 loadgp
2043#endif
2044
2045
2046 .import ftrace_return_to_handler,code
2047 load32 ftrace_return_to_handler,%ret0
2048 load32 .Lftrace_ret,%r2
2049#ifdef CONFIG_64BIT
2050 ldo -16(%sp),%ret1
2051 bve (%ret0)
2052#else
2053 bv %r0(%ret0)
2054#endif
2055 ldi 0,%r26
2056.Lftrace_ret:
2057 copy %ret0,%rp
2058
2059
2060 LDREG 8(%r3),%ret0
2061 LDREG 16(%r3),%ret1
2062
2063
2064#ifdef CONFIG_64BIT
2065 bve (%rp)
2066#else
2067 bv %r0(%rp)
2068#endif
2069 LDREGM -FRAME_SIZE(%sp),%r3
2070ENDPROC_CFI(return_to_handler)
2071
2072#endif
2073
2074#endif
2075
2076#ifdef CONFIG_IRQSTACKS
2077
2078
2079ENTRY_CFI(call_on_stack, FRAME=2*FRAME_SIZE,CALLS,SAVE_RP,SAVE_SP)
2080ENTRY(_call_on_stack)
2081 copy %sp, %r1
2082
2083
2084
2085
2086
2087
2088
2089 ldo 2*FRAME_SIZE(%arg2), %sp
2090# ifdef CONFIG_64BIT
2091
2092 STREG %rp, -FRAME_SIZE-RP_OFFSET(%sp)
2093
2094 LDREG 16(%arg1), %arg1
2095 bve,l (%arg1), %rp
2096 STREG %r1, -FRAME_SIZE-REG_SZ(%sp)
2097 LDREG -FRAME_SIZE-RP_OFFSET(%sp), %rp
2098 bve (%rp)
2099 LDREG -FRAME_SIZE-REG_SZ(%sp), %sp
2100# else
2101
2102 STREG %r1, -FRAME_SIZE-REG_SZ(%sp)
2103 STREG %rp, -FRAME_SIZE-RP_OFFSET(%sp)
2104
2105 bb,>=,n %arg1, 30, 1f
2106 depwi 0,31,2, %arg1
2107 LDREG 0(%arg1), %arg1
21081:
2109 be,l 0(%sr4,%arg1), %sr0, %r31
2110 copy %r31, %rp
2111 LDREG -FRAME_SIZE-RP_OFFSET(%sp), %rp
2112 bv (%rp)
2113 LDREG -FRAME_SIZE-REG_SZ(%sp), %sp
2114# endif
2115ENDPROC_CFI(call_on_stack)
2116#endif
2117
2118ENTRY_CFI(get_register)
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129 blr %r8,%r0
2130 nop
2131 bv %r0(%r25)
2132 copy %r0,%r1
2133 bv %r0(%r25)
2134 ldi -1,%r1
2135 bv %r0(%r25)
2136 copy %r2,%r1
2137 bv %r0(%r25)
2138 copy %r3,%r1
2139 bv %r0(%r25)
2140 copy %r4,%r1
2141 bv %r0(%r25)
2142 copy %r5,%r1
2143 bv %r0(%r25)
2144 copy %r6,%r1
2145 bv %r0(%r25)
2146 copy %r7,%r1
2147 bv %r0(%r25)
2148 ldi -1,%r1
2149 bv %r0(%r25)
2150 ldi -1,%r1
2151 bv %r0(%r25)
2152 copy %r10,%r1
2153 bv %r0(%r25)
2154 copy %r11,%r1
2155 bv %r0(%r25)
2156 copy %r12,%r1
2157 bv %r0(%r25)
2158 copy %r13,%r1
2159 bv %r0(%r25)
2160 copy %r14,%r1
2161 bv %r0(%r25)
2162 copy %r15,%r1
2163 bv %r0(%r25)
2164 ldi -1,%r1
2165 bv %r0(%r25)
2166 ldi -1,%r1
2167 bv %r0(%r25)
2168 copy %r18,%r1
2169 bv %r0(%r25)
2170 copy %r19,%r1
2171 bv %r0(%r25)
2172 copy %r20,%r1
2173 bv %r0(%r25)
2174 copy %r21,%r1
2175 bv %r0(%r25)
2176 copy %r22,%r1
2177 bv %r0(%r25)
2178 copy %r23,%r1
2179 bv %r0(%r25)
2180 ldi -1,%r1
2181 bv %r0(%r25)
2182 ldi -1,%r1
2183 bv %r0(%r25)
2184 copy %r26,%r1
2185 bv %r0(%r25)
2186 copy %r27,%r1
2187 bv %r0(%r25)
2188 copy %r28,%r1
2189 bv %r0(%r25)
2190 copy %r29,%r1
2191 bv %r0(%r25)
2192 copy %r30,%r1
2193 bv %r0(%r25)
2194 copy %r31,%r1
2195ENDPROC_CFI(get_register)
2196
2197
2198ENTRY_CFI(set_register)
2199
2200
2201
2202
2203
2204 blr %r8,%r0
2205 nop
2206 bv %r0(%r25)
2207 copy %r1,%r0
2208 bv %r0(%r25)
2209 copy %r1,%r1
2210 bv %r0(%r25)
2211 copy %r1,%r2
2212 bv %r0(%r25)
2213 copy %r1,%r3
2214 bv %r0(%r25)
2215 copy %r1,%r4
2216 bv %r0(%r25)
2217 copy %r1,%r5
2218 bv %r0(%r25)
2219 copy %r1,%r6
2220 bv %r0(%r25)
2221 copy %r1,%r7
2222 bv %r0(%r25)
2223 copy %r1,%r8
2224 bv %r0(%r25)
2225 copy %r1,%r9
2226 bv %r0(%r25)
2227 copy %r1,%r10
2228 bv %r0(%r25)
2229 copy %r1,%r11
2230 bv %r0(%r25)
2231 copy %r1,%r12
2232 bv %r0(%r25)
2233 copy %r1,%r13
2234 bv %r0(%r25)
2235 copy %r1,%r14
2236 bv %r0(%r25)
2237 copy %r1,%r15
2238 bv %r0(%r25)
2239 copy %r1,%r16
2240 bv %r0(%r25)
2241 copy %r1,%r17
2242 bv %r0(%r25)
2243 copy %r1,%r18
2244 bv %r0(%r25)
2245 copy %r1,%r19
2246 bv %r0(%r25)
2247 copy %r1,%r20
2248 bv %r0(%r25)
2249 copy %r1,%r21
2250 bv %r0(%r25)
2251 copy %r1,%r22
2252 bv %r0(%r25)
2253 copy %r1,%r23
2254 bv %r0(%r25)
2255 copy %r1,%r24
2256 bv %r0(%r25)
2257 copy %r1,%r25
2258 bv %r0(%r25)
2259 copy %r1,%r26
2260 bv %r0(%r25)
2261 copy %r1,%r27
2262 bv %r0(%r25)
2263 copy %r1,%r28
2264 bv %r0(%r25)
2265 copy %r1,%r29
2266 bv %r0(%r25)
2267 copy %r1,%r30
2268 bv %r0(%r25)
2269 copy %r1,%r31
2270ENDPROC_CFI(set_register)
2271
2272