Lines Matching refs:p

204 static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance)  in uasm_bgezl_hazard()  argument
208 uasm_il_bgezl(p, r, 0, label_tlbw_hazard_0 + instance); in uasm_bgezl_hazard()
215 static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance) in uasm_bgezl_label() argument
219 uasm_build_label(l, *p, label_tlbw_hazard_0 + instance); in uasm_bgezl_label()
352 static struct work_registers build_get_work_registers(u32 **p) in build_get_work_registers() argument
358 UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg); in build_get_work_registers()
367 UASM_i_CPUID_MFC0(p, K0, SMP_CPUID_REG); in build_get_work_registers()
368 UASM_i_SRL_SAFE(p, K0, K0, SMP_CPUID_REGSHIFT); in build_get_work_registers()
371 UASM_i_SLL(p, K0, K0, ilog2(sizeof(struct tlb_reg_save))); in build_get_work_registers()
373 UASM_i_LA(p, K1, (long)&handler_reg_save); in build_get_work_registers()
374 UASM_i_ADDU(p, K0, K0, K1); in build_get_work_registers()
376 UASM_i_LA(p, K0, (long)&handler_reg_save); in build_get_work_registers()
379 UASM_i_SW(p, 1, offsetof(struct tlb_reg_save, a), K0); in build_get_work_registers()
380 UASM_i_SW(p, 2, offsetof(struct tlb_reg_save, b), K0); in build_get_work_registers()
388 static void build_restore_work_registers(u32 **p) in build_restore_work_registers() argument
391 uasm_i_ehb(p); in build_restore_work_registers()
392 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_restore_work_registers()
396 UASM_i_LW(p, 1, offsetof(struct tlb_reg_save, a), K0); in build_restore_work_registers()
397 UASM_i_LW(p, 2, offsetof(struct tlb_reg_save, b), K0); in build_restore_work_registers()
411 u32 *p; in build_r3000_tlb_refill_handler() local
414 p = tlb_handler; in build_r3000_tlb_refill_handler()
416 uasm_i_mfc0(&p, K0, C0_BADVADDR); in build_r3000_tlb_refill_handler()
417 uasm_i_lui(&p, K1, uasm_rel_hi(pgdc)); /* cp0 delay */ in build_r3000_tlb_refill_handler()
418 uasm_i_lw(&p, K1, uasm_rel_lo(pgdc), K1); in build_r3000_tlb_refill_handler()
419 uasm_i_srl(&p, K0, K0, 22); /* load delay */ in build_r3000_tlb_refill_handler()
420 uasm_i_sll(&p, K0, K0, 2); in build_r3000_tlb_refill_handler()
421 uasm_i_addu(&p, K1, K1, K0); in build_r3000_tlb_refill_handler()
422 uasm_i_mfc0(&p, K0, C0_CONTEXT); in build_r3000_tlb_refill_handler()
423 uasm_i_lw(&p, K1, 0, K1); /* cp0 delay */ in build_r3000_tlb_refill_handler()
424 uasm_i_andi(&p, K0, K0, 0xffc); /* load delay */ in build_r3000_tlb_refill_handler()
425 uasm_i_addu(&p, K1, K1, K0); in build_r3000_tlb_refill_handler()
426 uasm_i_lw(&p, K0, 0, K1); in build_r3000_tlb_refill_handler()
427 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_refill_handler()
428 uasm_i_mtc0(&p, K0, C0_ENTRYLO0); in build_r3000_tlb_refill_handler()
429 uasm_i_mfc0(&p, K1, C0_EPC); /* cp0 delay */ in build_r3000_tlb_refill_handler()
430 uasm_i_tlbwr(&p); /* cp0 delay */ in build_r3000_tlb_refill_handler()
431 uasm_i_jr(&p, K1); in build_r3000_tlb_refill_handler()
432 uasm_i_rfe(&p); /* branch delay */ in build_r3000_tlb_refill_handler()
434 if (p > tlb_handler + 32) in build_r3000_tlb_refill_handler()
438 (unsigned int)(p - tlb_handler)); in build_r3000_tlb_refill_handler()
477 static void __maybe_unused build_tlb_probe_entry(u32 **p) in build_tlb_probe_entry() argument
485 uasm_i_nop(p); in build_tlb_probe_entry()
486 uasm_i_tlbp(p); in build_tlb_probe_entry()
490 uasm_i_tlbp(p); in build_tlb_probe_entry()
495 void build_tlb_write_entry(u32 **p, struct uasm_label **l, in build_tlb_write_entry() argument
508 uasm_i_ehb(p); in build_tlb_write_entry()
509 tlbw(p); in build_tlb_write_entry()
524 uasm_bgezl_hazard(p, r, hazard_instance); in build_tlb_write_entry()
525 tlbw(p); in build_tlb_write_entry()
526 uasm_bgezl_label(l, p, hazard_instance); in build_tlb_write_entry()
528 uasm_i_nop(p); in build_tlb_write_entry()
533 uasm_i_nop(p); in build_tlb_write_entry()
534 tlbw(p); in build_tlb_write_entry()
535 uasm_i_nop(p); in build_tlb_write_entry()
540 uasm_i_nop(p); /* QED specifies 2 nops hazard */ in build_tlb_write_entry()
541 uasm_i_nop(p); /* QED specifies 2 nops hazard */ in build_tlb_write_entry()
542 tlbw(p); in build_tlb_write_entry()
549 uasm_i_nop(p); in build_tlb_write_entry()
550 tlbw(p); in build_tlb_write_entry()
575 uasm_i_nop(p); in build_tlb_write_entry()
578 tlbw(p); in build_tlb_write_entry()
582 uasm_i_nop(p); in build_tlb_write_entry()
583 uasm_i_nop(p); in build_tlb_write_entry()
584 uasm_i_nop(p); in build_tlb_write_entry()
585 uasm_i_nop(p); in build_tlb_write_entry()
586 tlbw(p); in build_tlb_write_entry()
590 tlbw(p); in build_tlb_write_entry()
591 uasm_i_nop(p); in build_tlb_write_entry()
602 static __maybe_unused void build_convert_pte_to_entrylo(u32 **p, in build_convert_pte_to_entrylo() argument
612 UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
614 UASM_i_SRL(p, reg, reg, ilog2(_PAGE_NO_EXEC)); in build_convert_pte_to_entrylo()
615 UASM_i_ROTR(p, reg, reg, in build_convert_pte_to_entrylo()
620 uasm_i_dsrl_safe(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
622 UASM_i_SRL(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
629 static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, in build_restore_pagemask() argument
639 uasm_i_ehb(p); in build_restore_pagemask()
643 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); in build_restore_pagemask()
644 uasm_i_ori(p, tmp, tmp, PM_DEFAULT_MASK & 0xffff); in build_restore_pagemask()
645 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
646 uasm_il_b(p, r, lid); in build_restore_pagemask()
648 uasm_i_ori(p, tmp, 0, PM_DEFAULT_MASK); in build_restore_pagemask()
649 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
650 uasm_il_b(p, r, lid); in build_restore_pagemask()
652 uasm_i_mtc0(p, 0, C0_PAGEMASK); in build_restore_pagemask()
653 uasm_il_b(p, r, lid); in build_restore_pagemask()
656 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_restore_pagemask()
658 UASM_i_LW(p, 1, scratchpad_offset(0), 0); in build_restore_pagemask()
662 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); in build_restore_pagemask()
663 uasm_i_ori(p, tmp, tmp, PM_DEFAULT_MASK & 0xffff); in build_restore_pagemask()
664 uasm_il_b(p, r, lid); in build_restore_pagemask()
665 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
667 uasm_i_ori(p, tmp, 0, PM_DEFAULT_MASK); in build_restore_pagemask()
668 uasm_il_b(p, r, lid); in build_restore_pagemask()
669 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
671 uasm_il_b(p, r, lid); in build_restore_pagemask()
672 uasm_i_mtc0(p, 0, C0_PAGEMASK); in build_restore_pagemask()
677 static void build_huge_tlb_write_entry(u32 **p, struct uasm_label **l, in build_huge_tlb_write_entry() argument
684 uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16); in build_huge_tlb_write_entry()
685 uasm_i_ori(p, tmp, tmp, PM_HUGE_MASK & 0xffff); in build_huge_tlb_write_entry()
686 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_huge_tlb_write_entry()
688 build_tlb_write_entry(p, l, r, wmode); in build_huge_tlb_write_entry()
690 build_restore_pagemask(p, r, tmp, label_leave, restore_scratch); in build_huge_tlb_write_entry()
697 build_is_huge_pte(u32 **p, struct uasm_reloc **r, unsigned int tmp, in build_is_huge_pte() argument
700 UASM_i_LW(p, tmp, 0, pmd); in build_is_huge_pte()
702 uasm_il_bbit1(p, r, tmp, ilog2(_PAGE_HUGE), lid); in build_is_huge_pte()
704 uasm_i_andi(p, tmp, tmp, _PAGE_HUGE); in build_is_huge_pte()
705 uasm_il_bnez(p, r, tmp, lid); in build_is_huge_pte()
709 static void build_huge_update_entries(u32 **p, unsigned int pte, in build_huge_update_entries() argument
727 uasm_i_lui(p, tmp, HPAGE_SIZE >> (7 + 16)); in build_huge_update_entries()
729 build_convert_pte_to_entrylo(p, pte); in build_huge_update_entries()
730 UASM_i_MTC0(p, pte, C0_ENTRYLO0); /* load it */ in build_huge_update_entries()
733 UASM_i_ADDIU(p, pte, pte, HPAGE_SIZE >> 7); in build_huge_update_entries()
735 UASM_i_ADDU(p, pte, pte, tmp); in build_huge_update_entries()
737 UASM_i_MTC0(p, pte, C0_ENTRYLO1); /* load it */ in build_huge_update_entries()
740 static void build_huge_handler_tail(u32 **p, struct uasm_reloc **r, in build_huge_handler_tail() argument
747 UASM_i_SC(p, pte, 0, ptr); in build_huge_handler_tail()
748 uasm_il_beqz(p, r, pte, label_tlb_huge_update); in build_huge_handler_tail()
749 UASM_i_LW(p, pte, 0, ptr); /* Needed because SC killed our PTE */ in build_huge_handler_tail()
751 UASM_i_SW(p, pte, 0, ptr); in build_huge_handler_tail()
756 UASM_i_MFC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
757 uasm_i_ori(p, ptr, ptr, MIPS_ENTRYHI_EHINV); in build_huge_handler_tail()
758 UASM_i_MTC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
759 build_tlb_write_entry(p, l, r, tlb_indexed); in build_huge_handler_tail()
761 uasm_i_xori(p, ptr, ptr, MIPS_ENTRYHI_EHINV); in build_huge_handler_tail()
762 UASM_i_MTC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
763 build_huge_update_entries(p, pte, ptr); in build_huge_handler_tail()
764 build_huge_tlb_write_entry(p, l, r, pte, tlb_random, 0); in build_huge_handler_tail()
769 build_huge_update_entries(p, pte, ptr); in build_huge_handler_tail()
770 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0); in build_huge_handler_tail()
779 void build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, in build_get_pmde64() argument
788 uasm_i_dmfc0(p, tmp, C0_BADVADDR); in build_get_pmde64()
802 uasm_i_dsrl_safe(p, ptr, tmp, PGDIR_SHIFT + PGD_TABLE_ORDER + PAGE_SHIFT - 3); in build_get_pmde64()
803 uasm_il_bnez(p, r, ptr, label_vmalloc); in build_get_pmde64()
805 uasm_il_bltz(p, r, tmp, label_vmalloc); in build_get_pmde64()
812 UASM_i_MFC0(p, ptr, C0_PWBASE); in build_get_pmde64()
814 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_get_pmde64()
820 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_get_pmde64()
823 uasm_i_dins(p, ptr, 0, 0, 23); in build_get_pmde64()
826 uasm_i_ori(p, ptr, ptr, ((u64)(CAC_BASE) >> 53)); in build_get_pmde64()
827 uasm_i_drotr(p, ptr, ptr, 11); in build_get_pmde64()
829 UASM_i_CPUID_MFC0(p, ptr, SMP_CPUID_REG); in build_get_pmde64()
830 uasm_i_dsrl_safe(p, ptr, ptr, SMP_CPUID_PTRSHIFT); in build_get_pmde64()
831 UASM_i_LA_mostly(p, tmp, pgdc); in build_get_pmde64()
832 uasm_i_daddu(p, ptr, ptr, tmp); in build_get_pmde64()
833 uasm_i_dmfc0(p, tmp, C0_BADVADDR); in build_get_pmde64()
834 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pmde64()
836 UASM_i_LA_mostly(p, ptr, pgdc); in build_get_pmde64()
837 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pmde64()
841 uasm_l_vmalloc_done(l, *p); in build_get_pmde64()
844 uasm_i_dsrl_safe(p, tmp, tmp, PGDIR_SHIFT - 3); in build_get_pmde64()
846 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3); in build_get_pmde64()
847 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */ in build_get_pmde64()
849 uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pmde64()
850 uasm_i_ld(p, ptr, 0, ptr); /* get pud pointer */ in build_get_pmde64()
851 uasm_i_dsrl_safe(p, tmp, tmp, PUD_SHIFT - 3); /* get pud offset in bytes */ in build_get_pmde64()
852 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PUD - 1) << 3); in build_get_pmde64()
853 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pud offset */ in build_get_pmde64()
856 uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pmde64()
857 uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */ in build_get_pmde64()
858 uasm_i_dsrl_safe(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */ in build_get_pmde64()
859 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3); in build_get_pmde64()
860 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */ in build_get_pmde64()
870 build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, in build_get_pgd_vmalloc64() argument
880 uasm_l_vmalloc(l, *p); in build_get_pgd_vmalloc64()
884 uasm_il_bltz(p, r, bvaddr, label_vmalloc_done); in build_get_pgd_vmalloc64()
885 uasm_i_lui(p, ptr, uasm_rel_hi(swpd)); in build_get_pgd_vmalloc64()
889 uasm_il_bgez(p, r, bvaddr, label_large_segbits_fault); in build_get_pgd_vmalloc64()
894 uasm_il_b(p, r, label_vmalloc_done); in build_get_pgd_vmalloc64()
895 uasm_i_lui(p, ptr, uasm_rel_hi(swpd)); in build_get_pgd_vmalloc64()
897 UASM_i_LA_mostly(p, ptr, swpd); in build_get_pgd_vmalloc64()
898 uasm_il_b(p, r, label_vmalloc_done); in build_get_pgd_vmalloc64()
900 uasm_i_addiu(p, ptr, ptr, uasm_rel_lo(swpd)); in build_get_pgd_vmalloc64()
902 uasm_i_daddiu(p, ptr, ptr, uasm_rel_lo(swpd)); in build_get_pgd_vmalloc64()
906 uasm_l_large_segbits_fault(l, *p); in build_get_pgd_vmalloc64()
909 uasm_i_ehb(p); in build_get_pgd_vmalloc64()
924 uasm_i_sync(p, 0); in build_get_pgd_vmalloc64()
925 UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); in build_get_pgd_vmalloc64()
926 uasm_i_jr(p, ptr); in build_get_pgd_vmalloc64()
930 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_get_pgd_vmalloc64()
932 UASM_i_LW(p, 1, scratchpad_offset(0), 0); in build_get_pgd_vmalloc64()
934 uasm_i_nop(p); in build_get_pgd_vmalloc64()
945 void build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) in build_get_pgde32() argument
949 uasm_i_mfc0(p, ptr, c0_kscratch(), pgd_reg); in build_get_pgde32()
950 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pgde32()
956 uasm_i_mfc0(p, ptr, SMP_CPUID_REG); in build_get_pgde32()
957 UASM_i_LA_mostly(p, tmp, pgdc); in build_get_pgde32()
958 uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT); in build_get_pgde32()
959 uasm_i_addu(p, ptr, tmp, ptr); in build_get_pgde32()
961 UASM_i_LA_mostly(p, ptr, pgdc); in build_get_pgde32()
963 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pgde32()
964 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pgde32()
966 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ in build_get_pgde32()
967 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); in build_get_pgde32()
968 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ in build_get_pgde32()
974 static void build_adjust_context(u32 **p, unsigned int ctx) in build_adjust_context() argument
980 UASM_i_SRL(p, ctx, ctx, shift); in build_adjust_context()
981 uasm_i_andi(p, ctx, ctx, mask); in build_adjust_context()
984 void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) in build_get_ptep() argument
995 UASM_i_LW(p, ptr, 0, ptr); in build_get_ptep()
996 GET_CONTEXT(p, tmp); /* get context reg */ in build_get_ptep()
1000 GET_CONTEXT(p, tmp); /* get context reg */ in build_get_ptep()
1001 UASM_i_LW(p, ptr, 0, ptr); in build_get_ptep()
1005 build_adjust_context(p, tmp); in build_get_ptep()
1006 UASM_i_ADDU(p, ptr, ptr, tmp); /* add in offset */ in build_get_ptep()
1010 void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep) in build_update_entries() argument
1022 uasm_i_lw(p, tmp, pte_off_even, ptep); /* even pte */ in build_update_entries()
1023 UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); in build_update_entries()
1024 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); in build_update_entries()
1027 uasm_i_lw(p, tmp, 0, ptep); in build_update_entries()
1028 uasm_i_ext(p, tmp, tmp, 0, 24); in build_update_entries()
1029 uasm_i_mthc0(p, tmp, C0_ENTRYLO0); in build_update_entries()
1032 uasm_i_lw(p, tmp, pte_off_odd, ptep); /* odd pte */ in build_update_entries()
1033 UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); in build_update_entries()
1034 UASM_i_MTC0(p, tmp, C0_ENTRYLO1); in build_update_entries()
1037 uasm_i_lw(p, tmp, sizeof(pte_t), ptep); in build_update_entries()
1038 uasm_i_ext(p, tmp, tmp, 0, 24); in build_update_entries()
1039 uasm_i_mthc0(p, tmp, C0_ENTRYLO1); in build_update_entries()
1044 UASM_i_LW(p, tmp, pte_off_even, ptep); /* get even pte */ in build_update_entries()
1045 UASM_i_LW(p, ptep, pte_off_odd, ptep); /* get odd pte */ in build_update_entries()
1047 build_tlb_probe_entry(p); in build_update_entries()
1048 build_convert_pte_to_entrylo(p, tmp); in build_update_entries()
1050 UASM_i_MTC0(p, 0, C0_ENTRYLO0); in build_update_entries()
1051 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */ in build_update_entries()
1052 build_convert_pte_to_entrylo(p, ptep); in build_update_entries()
1054 uasm_i_mfc0(p, tmp, C0_INDEX); in build_update_entries()
1056 UASM_i_MTC0(p, 0, C0_ENTRYLO1); in build_update_entries()
1057 UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */ in build_update_entries()
1068 build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, in build_fast_tlb_refill_handler() argument
1082 UASM_i_MFC0(p, tmp, C0_BADVADDR); in build_fast_tlb_refill_handler()
1085 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_fast_tlb_refill_handler()
1087 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_fast_tlb_refill_handler()
1090 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1092 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1094 uasm_i_dsrl_safe(p, scratch, tmp, in build_fast_tlb_refill_handler()
1096 uasm_il_bnez(p, r, scratch, label_vmalloc); in build_fast_tlb_refill_handler()
1101 uasm_i_dins(p, ptr, 0, 0, 23); in build_fast_tlb_refill_handler()
1105 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_fast_tlb_refill_handler()
1107 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_fast_tlb_refill_handler()
1109 UASM_i_MFC0(p, tmp, C0_BADVADDR); in build_fast_tlb_refill_handler()
1112 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1114 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1118 uasm_i_dins(p, ptr, 0, 0, 23); in build_fast_tlb_refill_handler()
1120 uasm_il_bltz(p, r, tmp, label_vmalloc); in build_fast_tlb_refill_handler()
1126 uasm_i_ori(p, ptr, ptr, ((u64)(CAC_BASE) >> 53)); in build_fast_tlb_refill_handler()
1128 uasm_i_drotr(p, ptr, ptr, 11); in build_fast_tlb_refill_handler()
1139 uasm_i_dsrl_safe(p, scratch, tmp, PGDIR_SHIFT - 3); in build_fast_tlb_refill_handler()
1141 uasm_l_vmalloc_done(l, *p); in build_fast_tlb_refill_handler()
1151 uasm_i_dsrl_safe(p, scratch, tmp, PGDIR_SHIFT - 3); in build_fast_tlb_refill_handler()
1154 GET_CONTEXT(p, tmp); /* get context reg */ in build_fast_tlb_refill_handler()
1156 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PGD - 1) << 3); in build_fast_tlb_refill_handler()
1159 UASM_i_LWX(p, LOC_PTEP, scratch, ptr); in build_fast_tlb_refill_handler()
1161 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pgd offset */ in build_fast_tlb_refill_handler()
1162 uasm_i_ld(p, LOC_PTEP, 0, ptr); /* get pmd pointer */ in build_fast_tlb_refill_handler()
1167 uasm_i_dsrl_safe(p, scratch, tmp, PUD_SHIFT - 3); in build_fast_tlb_refill_handler()
1168 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PUD - 1) << 3); in build_fast_tlb_refill_handler()
1171 UASM_i_LWX(p, ptr, scratch, ptr); in build_fast_tlb_refill_handler()
1173 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pmd offset */ in build_fast_tlb_refill_handler()
1174 UASM_i_LW(p, ptr, 0, ptr); in build_fast_tlb_refill_handler()
1182 uasm_i_dsrl_safe(p, scratch, tmp, PMD_SHIFT - 3); in build_fast_tlb_refill_handler()
1183 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PMD - 1) << 3); in build_fast_tlb_refill_handler()
1184 GET_CONTEXT(p, tmp); /* get context reg */ in build_fast_tlb_refill_handler()
1187 UASM_i_LWX(p, scratch, scratch, ptr); in build_fast_tlb_refill_handler()
1189 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pmd offset */ in build_fast_tlb_refill_handler()
1190 UASM_i_LW(p, scratch, 0, ptr); in build_fast_tlb_refill_handler()
1194 build_adjust_context(p, tmp); in build_fast_tlb_refill_handler()
1197 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update); in build_fast_tlb_refill_handler()
1204 uasm_i_nop(p); in build_fast_tlb_refill_handler()
1212 UASM_i_LWX(p, even, scratch, tmp); in build_fast_tlb_refill_handler()
1213 UASM_i_ADDIU(p, tmp, tmp, sizeof(pte_t)); in build_fast_tlb_refill_handler()
1214 UASM_i_LWX(p, odd, scratch, tmp); in build_fast_tlb_refill_handler()
1216 UASM_i_ADDU(p, ptr, scratch, tmp); /* add in offset */ in build_fast_tlb_refill_handler()
1219 UASM_i_LW(p, even, 0, ptr); /* get even pte */ in build_fast_tlb_refill_handler()
1220 UASM_i_LW(p, odd, sizeof(pte_t), ptr); /* get odd pte */ in build_fast_tlb_refill_handler()
1223 uasm_i_drotr(p, even, even, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1224 UASM_i_MTC0(p, even, C0_ENTRYLO0); /* load it */ in build_fast_tlb_refill_handler()
1225 uasm_i_drotr(p, odd, odd, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1227 uasm_i_dsrl_safe(p, even, even, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1228 UASM_i_MTC0(p, even, C0_ENTRYLO0); /* load it */ in build_fast_tlb_refill_handler()
1229 uasm_i_dsrl_safe(p, odd, odd, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1231 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ in build_fast_tlb_refill_handler()
1234 uasm_i_ehb(p); in build_fast_tlb_refill_handler()
1235 UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1236 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1237 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1240 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1241 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1242 UASM_i_LW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1244 UASM_i_LW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1245 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1246 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1250 uasm_i_eret(p); /* return from trap */ in build_fast_tlb_refill_handler()
1265 u32 *p = tlb_handler; in build_r4000_tlb_refill_handler() local
1279 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1, in build_r4000_tlb_refill_handler()
1293 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_r4000_tlb_refill_handler()
1294 uasm_i_dmfc0(&p, K1, C0_ENTRYHI); in build_r4000_tlb_refill_handler()
1295 uasm_i_xor(&p, K0, K0, K1); in build_r4000_tlb_refill_handler()
1296 uasm_i_dsrl_safe(&p, K1, K0, 62); in build_r4000_tlb_refill_handler()
1297 uasm_i_dsrl_safe(&p, K0, K0, 12 + 1); in build_r4000_tlb_refill_handler()
1298 uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits); in build_r4000_tlb_refill_handler()
1299 uasm_i_or(&p, K0, K0, K1); in build_r4000_tlb_refill_handler()
1300 uasm_il_bnez(&p, &r, K0, label_leave); in build_r4000_tlb_refill_handler()
1305 build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */ in build_r4000_tlb_refill_handler()
1307 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */ in build_r4000_tlb_refill_handler()
1311 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update); in build_r4000_tlb_refill_handler()
1314 build_get_ptep(&p, K0, K1); in build_r4000_tlb_refill_handler()
1315 build_update_entries(&p, K0, K1); in build_r4000_tlb_refill_handler()
1316 build_tlb_write_entry(&p, &l, &r, tlb_random); in build_r4000_tlb_refill_handler()
1317 uasm_l_leave(&l, p); in build_r4000_tlb_refill_handler()
1318 uasm_i_eret(&p); /* return from trap */ in build_r4000_tlb_refill_handler()
1321 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_refill_handler()
1323 UASM_i_LW(&p, htlb_info.huge_pte, 0, K1); in build_r4000_tlb_refill_handler()
1324 build_huge_update_entries(&p, htlb_info.huge_pte, K1); in build_r4000_tlb_refill_handler()
1325 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, in build_r4000_tlb_refill_handler()
1330 build_get_pgd_vmalloc64(&p, &l, &r, K0, K1, vmalloc_mode); in build_r4000_tlb_refill_handler()
1346 if ((p - tlb_handler) > 64) in build_r4000_tlb_refill_handler()
1353 uasm_copy_handler(relocs, labels, tlb_handler, p, f); in build_r4000_tlb_refill_handler()
1354 final_len = p - tlb_handler; in build_r4000_tlb_refill_handler()
1357 if (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 1) in build_r4000_tlb_refill_handler()
1358 || (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 3) in build_r4000_tlb_refill_handler()
1366 if ((p - tlb_handler) <= MIPS64_REFILL_INSNS) { in build_r4000_tlb_refill_handler()
1368 uasm_copy_handler(relocs, labels, tlb_handler, p, f); in build_r4000_tlb_refill_handler()
1369 final_len = p - tlb_handler; in build_r4000_tlb_refill_handler()
1389 split < p - MIPS64_REFILL_INSNS) in build_r4000_tlb_refill_handler()
1428 uasm_copy_handler(relocs, labels, split, p, final_handler); in build_r4000_tlb_refill_handler()
1430 (p - split); in build_r4000_tlb_refill_handler()
1494 u32 *p = tlb_handler; in build_loongson3_tlb_refill_handler() local
1503 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_loongson3_tlb_refill_handler()
1504 uasm_i_dsrl_safe(&p, K1, K0, PGDIR_SHIFT + PGD_TABLE_ORDER + PAGE_SHIFT - 3); in build_loongson3_tlb_refill_handler()
1505 uasm_il_beqz(&p, &r, K1, label_vmalloc); in build_loongson3_tlb_refill_handler()
1506 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1508 uasm_il_bgez(&p, &r, K0, label_large_segbits_fault); in build_loongson3_tlb_refill_handler()
1509 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1510 uasm_l_vmalloc(&l, p); in build_loongson3_tlb_refill_handler()
1513 uasm_i_dmfc0(&p, K1, C0_PGD); in build_loongson3_tlb_refill_handler()
1515 uasm_i_lddir(&p, K0, K1, 3); /* global page dir */ in build_loongson3_tlb_refill_handler()
1517 uasm_i_lddir(&p, K1, K0, 1); /* middle page dir */ in build_loongson3_tlb_refill_handler()
1519 uasm_i_ldpte(&p, K1, 0); /* even */ in build_loongson3_tlb_refill_handler()
1520 uasm_i_ldpte(&p, K1, 1); /* odd */ in build_loongson3_tlb_refill_handler()
1521 uasm_i_tlbwr(&p); in build_loongson3_tlb_refill_handler()
1525 uasm_i_lui(&p, K0, PM_DEFAULT_MASK >> 16); in build_loongson3_tlb_refill_handler()
1526 uasm_i_ori(&p, K0, K0, PM_DEFAULT_MASK & 0xffff); in build_loongson3_tlb_refill_handler()
1527 uasm_i_mtc0(&p, K0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1529 uasm_i_ori(&p, K0, 0, PM_DEFAULT_MASK); in build_loongson3_tlb_refill_handler()
1530 uasm_i_mtc0(&p, K0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1532 uasm_i_mtc0(&p, 0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1535 uasm_i_eret(&p); in build_loongson3_tlb_refill_handler()
1538 uasm_l_large_segbits_fault(&l, p); in build_loongson3_tlb_refill_handler()
1539 UASM_i_LA(&p, K1, (unsigned long)tlb_do_page_fault_0); in build_loongson3_tlb_refill_handler()
1540 uasm_i_jr(&p, K1); in build_loongson3_tlb_refill_handler()
1541 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1556 u32 *p = (u32 *)msk_isa16_mode((ulong)tlbmiss_handler_setup_pgd); in build_setup_pgd() local
1561 memset(p, 0, tlbmiss_handler_setup_pgd_end - (char *)p); in build_setup_pgd()
1577 UASM_i_SRA(&p, a1, a0, 29); in build_setup_pgd()
1578 UASM_i_ADDIU(&p, a1, a1, 4); in build_setup_pgd()
1579 uasm_il_bnez(&p, &r, a1, label_tlbl_goaround1); in build_setup_pgd()
1580 uasm_i_nop(&p); in build_setup_pgd()
1581 uasm_i_dinsm(&p, a0, 0, 29, 64 - 29); in build_setup_pgd()
1582 uasm_l_tlbl_goaround1(&l, p); in build_setup_pgd()
1583 UASM_i_SLL(&p, a0, a0, 11); in build_setup_pgd()
1584 UASM_i_MTC0(&p, a0, C0_CONTEXT); in build_setup_pgd()
1585 uasm_i_jr(&p, 31); in build_setup_pgd()
1586 uasm_i_ehb(&p); in build_setup_pgd()
1590 UASM_i_MTC0(&p, a0, C0_PWBASE); in build_setup_pgd()
1592 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); in build_setup_pgd()
1593 uasm_i_jr(&p, 31); in build_setup_pgd()
1594 uasm_i_ehb(&p); in build_setup_pgd()
1599 UASM_i_CPUID_MFC0(&p, a1, SMP_CPUID_REG); in build_setup_pgd()
1600 UASM_i_SRL_SAFE(&p, a1, a1, SMP_CPUID_PTRSHIFT); in build_setup_pgd()
1601 UASM_i_LA_mostly(&p, a2, pgdc); in build_setup_pgd()
1602 UASM_i_ADDU(&p, a2, a2, a1); in build_setup_pgd()
1603 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); in build_setup_pgd()
1605 UASM_i_LA_mostly(&p, a2, pgdc); in build_setup_pgd()
1606 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); in build_setup_pgd()
1611 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); in build_setup_pgd()
1612 uasm_i_jr(&p, 31); in build_setup_pgd()
1613 uasm_i_ehb(&p); in build_setup_pgd()
1615 uasm_i_jr(&p, 31); in build_setup_pgd()
1616 uasm_i_nop(&p); in build_setup_pgd()
1619 if (p >= (u32 *)tlbmiss_handler_setup_pgd_end) in build_setup_pgd()
1624 (unsigned int)(p - (u32 *)tlbmiss_handler_setup_pgd)); in build_setup_pgd()
1631 iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) in iPTE_LW() argument
1635 uasm_i_sync(p, 0); in iPTE_LW()
1638 uasm_i_lld(p, pte, 0, ptr); in iPTE_LW()
1641 UASM_i_LL(p, pte, 0, ptr); in iPTE_LW()
1645 uasm_i_ld(p, pte, 0, ptr); in iPTE_LW()
1648 UASM_i_LW(p, pte, 0, ptr); in iPTE_LW()
1653 iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr, in iPTE_SW() argument
1660 uasm_i_lui(p, scratch, swmode >> 16); in iPTE_SW()
1661 uasm_i_or(p, pte, pte, scratch); in iPTE_SW()
1664 uasm_i_ori(p, pte, pte, mode); in iPTE_SW()
1670 uasm_i_scd(p, pte, 0, ptr); in iPTE_SW()
1673 UASM_i_SC(p, pte, 0, ptr); in iPTE_SW()
1676 uasm_il_beqzl(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1678 uasm_il_beqz(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1683 uasm_i_ll(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1684 uasm_i_ori(p, pte, pte, hwmode); in iPTE_SW()
1686 uasm_i_sc(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1687 uasm_il_beqz(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1689 uasm_i_lw(p, pte, 0, ptr); in iPTE_SW()
1691 uasm_i_nop(p); in iPTE_SW()
1693 uasm_i_nop(p); in iPTE_SW()
1698 uasm_i_sd(p, pte, 0, ptr); in iPTE_SW()
1701 UASM_i_SW(p, pte, 0, ptr); in iPTE_SW()
1705 uasm_i_lw(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1706 uasm_i_ori(p, pte, pte, hwmode); in iPTE_SW()
1708 uasm_i_sw(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1709 uasm_i_lw(p, pte, 0, ptr); in iPTE_SW()
1721 build_pte_present(u32 **p, struct uasm_reloc **r, in build_pte_present() argument
1729 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); in build_pte_present()
1730 uasm_i_nop(p); in build_pte_present()
1733 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_present()
1736 uasm_i_andi(p, t, cur, 1); in build_pte_present()
1737 uasm_il_beqz(p, r, t, lid); in build_pte_present()
1740 iPTE_LW(p, pte, ptr); in build_pte_present()
1744 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_present()
1747 uasm_i_andi(p, t, cur, in build_pte_present()
1749 uasm_i_xori(p, t, t, _PAGE_PRESENT >> _PAGE_PRESENT_SHIFT); in build_pte_present()
1750 uasm_il_bnez(p, r, t, lid); in build_pte_present()
1753 iPTE_LW(p, pte, ptr); in build_pte_present()
1759 build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte, in build_make_valid() argument
1764 iPTE_SW(p, r, pte, ptr, mode, scratch); in build_make_valid()
1772 build_pte_writable(u32 **p, struct uasm_reloc **r, in build_pte_writable() argument
1780 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_writable()
1783 uasm_i_andi(p, t, cur, in build_pte_writable()
1785 uasm_i_xori(p, t, t, in build_pte_writable()
1787 uasm_il_bnez(p, r, t, lid); in build_pte_writable()
1790 iPTE_LW(p, pte, ptr); in build_pte_writable()
1792 uasm_i_nop(p); in build_pte_writable()
1799 build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte, in build_make_write() argument
1805 iPTE_SW(p, r, pte, ptr, mode, scratch); in build_make_write()
1813 build_pte_modifiable(u32 **p, struct uasm_reloc **r, in build_pte_modifiable() argument
1818 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_WRITE), lid); in build_pte_modifiable()
1819 uasm_i_nop(p); in build_pte_modifiable()
1822 uasm_i_srl(p, t, pte, _PAGE_WRITE_SHIFT); in build_pte_modifiable()
1823 uasm_i_andi(p, t, t, 1); in build_pte_modifiable()
1824 uasm_il_beqz(p, r, t, lid); in build_pte_modifiable()
1827 iPTE_LW(p, pte, ptr); in build_pte_modifiable()
1843 build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp) in build_r3000_pte_reload_tlbwi() argument
1845 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */ in build_r3000_pte_reload_tlbwi()
1846 uasm_i_mfc0(p, tmp, C0_EPC); /* cp0 delay */ in build_r3000_pte_reload_tlbwi()
1847 uasm_i_tlbwi(p); in build_r3000_pte_reload_tlbwi()
1848 uasm_i_jr(p, tmp); in build_r3000_pte_reload_tlbwi()
1849 uasm_i_rfe(p); /* branch delay */ in build_r3000_pte_reload_tlbwi()
1859 build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l, in build_r3000_tlb_reload_write() argument
1863 uasm_i_mfc0(p, tmp, C0_INDEX); in build_r3000_tlb_reload_write()
1864 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */ in build_r3000_tlb_reload_write()
1865 uasm_il_bltz(p, r, tmp, label_r3000_write_probe_fail); /* cp0 delay */ in build_r3000_tlb_reload_write()
1866 uasm_i_mfc0(p, tmp, C0_EPC); /* branch delay */ in build_r3000_tlb_reload_write()
1867 uasm_i_tlbwi(p); /* cp0 delay */ in build_r3000_tlb_reload_write()
1868 uasm_i_jr(p, tmp); in build_r3000_tlb_reload_write()
1869 uasm_i_rfe(p); /* branch delay */ in build_r3000_tlb_reload_write()
1870 uasm_l_r3000_write_probe_fail(l, *p); in build_r3000_tlb_reload_write()
1871 uasm_i_tlbwr(p); /* cp0 delay */ in build_r3000_tlb_reload_write()
1872 uasm_i_jr(p, tmp); in build_r3000_tlb_reload_write()
1873 uasm_i_rfe(p); /* branch delay */ in build_r3000_tlb_reload_write()
1877 build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte, in build_r3000_tlbchange_handler_head() argument
1882 uasm_i_mfc0(p, pte, C0_BADVADDR); in build_r3000_tlbchange_handler_head()
1883 uasm_i_lui(p, ptr, uasm_rel_hi(pgdc)); /* cp0 delay */ in build_r3000_tlbchange_handler_head()
1884 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); in build_r3000_tlbchange_handler_head()
1885 uasm_i_srl(p, pte, pte, 22); /* load delay */ in build_r3000_tlbchange_handler_head()
1886 uasm_i_sll(p, pte, pte, 2); in build_r3000_tlbchange_handler_head()
1887 uasm_i_addu(p, ptr, ptr, pte); in build_r3000_tlbchange_handler_head()
1888 uasm_i_mfc0(p, pte, C0_CONTEXT); in build_r3000_tlbchange_handler_head()
1889 uasm_i_lw(p, ptr, 0, ptr); /* cp0 delay */ in build_r3000_tlbchange_handler_head()
1890 uasm_i_andi(p, pte, pte, 0xffc); /* load delay */ in build_r3000_tlbchange_handler_head()
1891 uasm_i_addu(p, ptr, ptr, pte); in build_r3000_tlbchange_handler_head()
1892 uasm_i_lw(p, pte, 0, ptr); in build_r3000_tlbchange_handler_head()
1893 uasm_i_tlbp(p); /* load delay */ in build_r3000_tlbchange_handler_head()
1898 u32 *p = (u32 *)handle_tlbl; in build_r3000_tlb_load_handler() local
1902 memset(p, 0, handle_tlbl_end - (char *)p); in build_r3000_tlb_load_handler()
1906 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_load_handler()
1907 build_pte_present(&p, &r, K0, K1, -1, label_nopage_tlbl); in build_r3000_tlb_load_handler()
1908 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_load_handler()
1909 build_make_valid(&p, &r, K0, K1, -1); in build_r3000_tlb_load_handler()
1910 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); in build_r3000_tlb_load_handler()
1912 uasm_l_nopage_tlbl(&l, p); in build_r3000_tlb_load_handler()
1913 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); in build_r3000_tlb_load_handler()
1914 uasm_i_nop(&p); in build_r3000_tlb_load_handler()
1916 if (p >= (u32 *)handle_tlbl_end) in build_r3000_tlb_load_handler()
1921 (unsigned int)(p - (u32 *)handle_tlbl)); in build_r3000_tlb_load_handler()
1928 u32 *p = (u32 *)handle_tlbs; in build_r3000_tlb_store_handler() local
1932 memset(p, 0, handle_tlbs_end - (char *)p); in build_r3000_tlb_store_handler()
1936 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_store_handler()
1937 build_pte_writable(&p, &r, K0, K1, -1, label_nopage_tlbs); in build_r3000_tlb_store_handler()
1938 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_store_handler()
1939 build_make_write(&p, &r, K0, K1, -1); in build_r3000_tlb_store_handler()
1940 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); in build_r3000_tlb_store_handler()
1942 uasm_l_nopage_tlbs(&l, p); in build_r3000_tlb_store_handler()
1943 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r3000_tlb_store_handler()
1944 uasm_i_nop(&p); in build_r3000_tlb_store_handler()
1946 if (p >= (u32 *)handle_tlbs_end) in build_r3000_tlb_store_handler()
1951 (unsigned int)(p - (u32 *)handle_tlbs)); in build_r3000_tlb_store_handler()
1958 u32 *p = (u32 *)handle_tlbm; in build_r3000_tlb_modify_handler() local
1962 memset(p, 0, handle_tlbm_end - (char *)p); in build_r3000_tlb_modify_handler()
1966 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_modify_handler()
1967 build_pte_modifiable(&p, &r, K0, K1, -1, label_nopage_tlbm); in build_r3000_tlb_modify_handler()
1968 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_modify_handler()
1969 build_make_write(&p, &r, K0, K1, -1); in build_r3000_tlb_modify_handler()
1970 build_r3000_pte_reload_tlbwi(&p, K0, K1); in build_r3000_tlb_modify_handler()
1972 uasm_l_nopage_tlbm(&l, p); in build_r3000_tlb_modify_handler()
1973 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r3000_tlb_modify_handler()
1974 uasm_i_nop(&p); in build_r3000_tlb_modify_handler()
1976 if (p >= (u32 *)handle_tlbm_end) in build_r3000_tlb_modify_handler()
1981 (unsigned int)(p - (u32 *)handle_tlbm)); in build_r3000_tlb_modify_handler()
2011 build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, in build_r4000_tlbchange_handler_head() argument
2014 struct work_registers wr = build_get_work_registers(p); in build_r4000_tlbchange_handler_head()
2017 build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */ in build_r4000_tlbchange_handler_head()
2019 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */ in build_r4000_tlbchange_handler_head()
2028 build_is_huge_pte(p, r, wr.r1, wr.r2, label_tlb_huge_update); in build_r4000_tlbchange_handler_head()
2031 UASM_i_MFC0(p, wr.r1, C0_BADVADDR); in build_r4000_tlbchange_handler_head()
2032 UASM_i_LW(p, wr.r2, 0, wr.r2); in build_r4000_tlbchange_handler_head()
2033 UASM_i_SRL(p, wr.r1, wr.r1, PAGE_SHIFT - PTE_T_LOG2); in build_r4000_tlbchange_handler_head()
2034 uasm_i_andi(p, wr.r1, wr.r1, (PTRS_PER_PTE - 1) << PTE_T_LOG2); in build_r4000_tlbchange_handler_head()
2035 UASM_i_ADDU(p, wr.r2, wr.r2, wr.r1); in build_r4000_tlbchange_handler_head()
2038 uasm_l_smp_pgtable_change(l, *p); in build_r4000_tlbchange_handler_head()
2040 iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ in build_r4000_tlbchange_handler_head()
2042 build_tlb_probe_entry(p); in build_r4000_tlbchange_handler_head()
2045 uasm_i_ehb(p); in build_r4000_tlbchange_handler_head()
2046 uasm_i_mfc0(p, wr.r3, C0_INDEX); in build_r4000_tlbchange_handler_head()
2047 uasm_il_bltz(p, r, wr.r3, label_leave); in build_r4000_tlbchange_handler_head()
2048 uasm_i_nop(p); in build_r4000_tlbchange_handler_head()
2055 build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l, in build_r4000_tlbchange_handler_tail() argument
2059 uasm_i_ori(p, ptr, ptr, sizeof(pte_t)); in build_r4000_tlbchange_handler_tail()
2060 uasm_i_xori(p, ptr, ptr, sizeof(pte_t)); in build_r4000_tlbchange_handler_tail()
2061 build_update_entries(p, tmp, ptr); in build_r4000_tlbchange_handler_tail()
2062 build_tlb_write_entry(p, l, r, tlb_indexed); in build_r4000_tlbchange_handler_tail()
2063 uasm_l_leave(l, *p); in build_r4000_tlbchange_handler_tail()
2064 build_restore_work_registers(p); in build_r4000_tlbchange_handler_tail()
2065 uasm_i_eret(p); /* return from trap */ in build_r4000_tlbchange_handler_tail()
2068 build_get_pgd_vmalloc64(p, l, r, tmp, ptr, not_refill); in build_r4000_tlbchange_handler_tail()
2074 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbl); in build_r4000_tlb_load_handler() local
2079 memset(p, 0, handle_tlbl_end - (char *)p); in build_r4000_tlb_load_handler()
2086 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_r4000_tlb_load_handler()
2087 uasm_i_dmfc0(&p, K1, C0_ENTRYHI); in build_r4000_tlb_load_handler()
2088 uasm_i_xor(&p, K0, K0, K1); in build_r4000_tlb_load_handler()
2089 uasm_i_dsrl_safe(&p, K1, K0, 62); in build_r4000_tlb_load_handler()
2090 uasm_i_dsrl_safe(&p, K0, K0, 12 + 1); in build_r4000_tlb_load_handler()
2091 uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits); in build_r4000_tlb_load_handler()
2092 uasm_i_or(&p, K0, K0, K1); in build_r4000_tlb_load_handler()
2093 uasm_il_bnez(&p, &r, K0, label_leave); in build_r4000_tlb_load_handler()
2097 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_load_handler()
2098 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2100 build_tlb_probe_entry(&p); in build_r4000_tlb_load_handler()
2108 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID), in build_r4000_tlb_load_handler()
2111 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID); in build_r4000_tlb_load_handler()
2112 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround1); in build_r4000_tlb_load_handler()
2114 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2124 uasm_i_tlbr(&p); in build_r4000_tlb_load_handler()
2127 uasm_i_ehb(&p); in build_r4000_tlb_load_handler()
2131 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); in build_r4000_tlb_load_handler()
2133 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t)); in build_r4000_tlb_load_handler()
2134 uasm_i_beqz(&p, wr.r3, 8); in build_r4000_tlb_load_handler()
2137 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0); in build_r4000_tlb_load_handler()
2139 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1); in build_r4000_tlb_load_handler()
2145 uasm_il_bbit1(&p, &r, wr.r3, 1, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2146 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2147 uasm_l_tlbl_goaround1(&l, p); in build_r4000_tlb_load_handler()
2149 uasm_i_andi(&p, wr.r3, wr.r3, 2); in build_r4000_tlb_load_handler()
2150 uasm_il_bnez(&p, &r, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2151 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2153 uasm_l_tlbl_goaround1(&l, p); in build_r4000_tlb_load_handler()
2155 build_make_valid(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_load_handler()
2156 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_load_handler()
2163 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_load_handler()
2164 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_load_handler()
2165 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2166 build_tlb_probe_entry(&p); in build_r4000_tlb_load_handler()
2174 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID), in build_r4000_tlb_load_handler()
2177 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID); in build_r4000_tlb_load_handler()
2178 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2180 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2190 uasm_i_tlbr(&p); in build_r4000_tlb_load_handler()
2193 uasm_i_ehb(&p); in build_r4000_tlb_load_handler()
2197 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); in build_r4000_tlb_load_handler()
2199 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t)); in build_r4000_tlb_load_handler()
2200 uasm_i_beqz(&p, wr.r3, 8); in build_r4000_tlb_load_handler()
2203 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0); in build_r4000_tlb_load_handler()
2205 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1); in build_r4000_tlb_load_handler()
2211 uasm_il_bbit0(&p, &r, wr.r3, 1, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2213 uasm_i_andi(&p, wr.r3, wr.r3, 2); in build_r4000_tlb_load_handler()
2214 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2217 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2222 build_restore_pagemask(&p, &r, wr.r3, label_nopage_tlbl, 0); in build_r4000_tlb_load_handler()
2224 uasm_l_tlbl_goaround2(&l, p); in build_r4000_tlb_load_handler()
2226 uasm_i_ori(&p, wr.r1, wr.r1, (_PAGE_ACCESSED | _PAGE_VALID)); in build_r4000_tlb_load_handler()
2227 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 1); in build_r4000_tlb_load_handler()
2230 uasm_l_nopage_tlbl(&l, p); in build_r4000_tlb_load_handler()
2232 uasm_i_sync(&p, 0); in build_r4000_tlb_load_handler()
2233 build_restore_work_registers(&p); in build_r4000_tlb_load_handler()
2236 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_0)); in build_r4000_tlb_load_handler()
2237 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_0)); in build_r4000_tlb_load_handler()
2238 uasm_i_jr(&p, K0); in build_r4000_tlb_load_handler()
2241 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); in build_r4000_tlb_load_handler()
2242 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2244 if (p >= (u32 *)handle_tlbl_end) in build_r4000_tlb_load_handler()
2249 (unsigned int)(p - (u32 *)handle_tlbl)); in build_r4000_tlb_load_handler()
2256 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbs); in build_r4000_tlb_store_handler() local
2261 memset(p, 0, handle_tlbs_end - (char *)p); in build_r4000_tlb_store_handler()
2265 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_store_handler()
2266 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs); in build_r4000_tlb_store_handler()
2268 build_tlb_probe_entry(&p); in build_r4000_tlb_store_handler()
2269 build_make_write(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_store_handler()
2270 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_store_handler()
2277 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_store_handler()
2278 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_store_handler()
2279 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs); in build_r4000_tlb_store_handler()
2280 build_tlb_probe_entry(&p); in build_r4000_tlb_store_handler()
2281 uasm_i_ori(&p, wr.r1, wr.r1, in build_r4000_tlb_store_handler()
2283 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 1); in build_r4000_tlb_store_handler()
2286 uasm_l_nopage_tlbs(&l, p); in build_r4000_tlb_store_handler()
2288 uasm_i_sync(&p, 0); in build_r4000_tlb_store_handler()
2289 build_restore_work_registers(&p); in build_r4000_tlb_store_handler()
2292 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_1)); in build_r4000_tlb_store_handler()
2293 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_1)); in build_r4000_tlb_store_handler()
2294 uasm_i_jr(&p, K0); in build_r4000_tlb_store_handler()
2297 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r4000_tlb_store_handler()
2298 uasm_i_nop(&p); in build_r4000_tlb_store_handler()
2300 if (p >= (u32 *)handle_tlbs_end) in build_r4000_tlb_store_handler()
2305 (unsigned int)(p - (u32 *)handle_tlbs)); in build_r4000_tlb_store_handler()
2312 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbm); in build_r4000_tlb_modify_handler() local
2317 memset(p, 0, handle_tlbm_end - (char *)p); in build_r4000_tlb_modify_handler()
2321 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_modify_handler()
2322 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm); in build_r4000_tlb_modify_handler()
2324 build_tlb_probe_entry(&p); in build_r4000_tlb_modify_handler()
2326 build_make_write(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_modify_handler()
2327 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_modify_handler()
2334 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_modify_handler()
2335 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_modify_handler()
2336 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm); in build_r4000_tlb_modify_handler()
2337 build_tlb_probe_entry(&p); in build_r4000_tlb_modify_handler()
2338 uasm_i_ori(&p, wr.r1, wr.r1, in build_r4000_tlb_modify_handler()
2340 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 0); in build_r4000_tlb_modify_handler()
2343 uasm_l_nopage_tlbm(&l, p); in build_r4000_tlb_modify_handler()
2345 uasm_i_sync(&p, 0); in build_r4000_tlb_modify_handler()
2346 build_restore_work_registers(&p); in build_r4000_tlb_modify_handler()
2349 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_1)); in build_r4000_tlb_modify_handler()
2350 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_1)); in build_r4000_tlb_modify_handler()
2351 uasm_i_jr(&p, K0); in build_r4000_tlb_modify_handler()
2354 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r4000_tlb_modify_handler()
2355 uasm_i_nop(&p); in build_r4000_tlb_modify_handler()
2357 if (p >= (u32 *)handle_tlbm_end) in build_r4000_tlb_modify_handler()
2362 (unsigned int)(p - (u32 *)handle_tlbm)); in build_r4000_tlb_modify_handler()