Lines Matching refs:tlb
48 ppc6xx_tlb_t *tlb; in ppc6xx_tlb_invalidate_all() local
52 tlb = &env->tlb.tlb6[nr]; in ppc6xx_tlb_invalidate_all()
53 pte_invalidate(&tlb->pte0); in ppc6xx_tlb_invalidate_all()
64 ppc6xx_tlb_t *tlb; in ppc6xx_tlb_invalidate_virt2() local
70 tlb = &env->tlb.tlb6[nr]; in ppc6xx_tlb_invalidate_virt2()
71 if (pte_is_valid(tlb->pte0) && (match_epn == 0 || eaddr == tlb->EPN)) { in ppc6xx_tlb_invalidate_virt2()
74 pte_invalidate(&tlb->pte0); in ppc6xx_tlb_invalidate_virt2()
75 tlb_flush_page(cs, tlb->EPN); in ppc6xx_tlb_invalidate_virt2()
93 ppc6xx_tlb_t *tlb; in ppc6xx_tlb_store() local
97 tlb = &env->tlb.tlb6[nr]; in ppc6xx_tlb_store()
103 tlb->pte0 = pte0; in ppc6xx_tlb_store()
104 tlb->pte1 = pte1; in ppc6xx_tlb_store()
105 tlb->EPN = EPN; in ppc6xx_tlb_store()
113 ppcemb_tlb_t *tlb; in ppc4xx_tlb_invalidate_all() local
117 tlb = &env->tlb.tlbe[i]; in ppc4xx_tlb_invalidate_all()
118 tlb->prot &= ~PAGE_VALID; in ppc4xx_tlb_invalidate_all()
128 ppcmas_tlb_t *tlb = env->tlb.tlbm; in booke206_flush_tlb() local
134 if (!check_iprot || !(tlb[j].mas1 & MAS1_IPROT)) { in booke206_flush_tlb()
135 tlb[j].mas1 &= ~MAS1_VALID; in booke206_flush_tlb()
139 tlb += booke206_tlb_size(env, i); in booke206_flush_tlb()
686 ppcemb_tlb_t *tlb; in helper_4xx_tlbre_hi() local
691 tlb = &env->tlb.tlbe[entry]; in helper_4xx_tlbre_hi()
692 ret = tlb->EPN; in helper_4xx_tlbre_hi()
693 if (tlb->prot & PAGE_VALID) { in helper_4xx_tlbre_hi()
696 size = booke_page_size_to_tlb(tlb->size); in helper_4xx_tlbre_hi()
701 helper_store_40x_pid(env, tlb->PID); in helper_4xx_tlbre_hi()
707 ppcemb_tlb_t *tlb; in helper_4xx_tlbre_lo() local
711 tlb = &env->tlb.tlbe[entry]; in helper_4xx_tlbre_lo()
712 ret = tlb->RPN; in helper_4xx_tlbre_lo()
713 if (tlb->prot & PAGE_EXEC) { in helper_4xx_tlbre_lo()
716 if (tlb->prot & PAGE_WRITE) { in helper_4xx_tlbre_lo()
722 static void ppcemb_tlb_flush(CPUState *cs, ppcemb_tlb_t *tlb) in ppcemb_tlb_flush() argument
726 if (tlb->prot & 0xf) { in ppcemb_tlb_flush()
729 if ((tlb->prot >> 4) & 0xf) { in ppcemb_tlb_flush()
732 if (tlb->attr & 1) { in ppcemb_tlb_flush()
736 tlb_flush_range_by_mmuidx(cs, tlb->EPN, tlb->size, mmu_idx, in ppcemb_tlb_flush()
744 ppcemb_tlb_t *tlb; in helper_4xx_tlbwe_hi() local
750 tlb = &env->tlb.tlbe[entry]; in helper_4xx_tlbwe_hi()
752 if ((tlb->prot & PAGE_VALID) && tlb->PID == env->spr[SPR_40x_PID]) { in helper_4xx_tlbwe_hi()
755 (int)entry, tlb->EPN, tlb->EPN + tlb->size); in helper_4xx_tlbwe_hi()
756 ppcemb_tlb_flush(cs, tlb); in helper_4xx_tlbwe_hi()
758 tlb->size = booke_tlb_to_page_size((val >> PPC4XX_TLBHI_SIZE_SHIFT) in helper_4xx_tlbwe_hi()
764 if ((val & PPC4XX_TLBHI_V) && tlb->size < TARGET_PAGE_SIZE) { in helper_4xx_tlbwe_hi()
768 tlb->size, TARGET_PAGE_SIZE, (int)((val >> 7) & 0x7)); in helper_4xx_tlbwe_hi()
770 tlb->EPN = val & ~(tlb->size - 1); in helper_4xx_tlbwe_hi()
772 tlb->prot |= PAGE_VALID; in helper_4xx_tlbwe_hi()
779 tlb->prot &= ~PAGE_VALID; in helper_4xx_tlbwe_hi()
781 tlb->PID = env->spr[SPR_40x_PID]; /* PID */ in helper_4xx_tlbwe_hi()
785 (int)entry, tlb->RPN, tlb->EPN, tlb->size, in helper_4xx_tlbwe_hi()
786 tlb->prot & PAGE_READ ? 'r' : '-', in helper_4xx_tlbwe_hi()
787 tlb->prot & PAGE_WRITE ? 'w' : '-', in helper_4xx_tlbwe_hi()
788 tlb->prot & PAGE_EXEC ? 'x' : '-', in helper_4xx_tlbwe_hi()
789 tlb->prot & PAGE_VALID ? 'v' : '-', (int)tlb->PID); in helper_4xx_tlbwe_hi()
796 ppcemb_tlb_t *tlb; in helper_4xx_tlbwe_lo() local
801 tlb = &env->tlb.tlbe[entry]; in helper_4xx_tlbwe_lo()
803 if ((tlb->prot & PAGE_VALID) && tlb->PID == env->spr[SPR_40x_PID]) { in helper_4xx_tlbwe_lo()
806 (int)entry, tlb->EPN, tlb->EPN + tlb->size); in helper_4xx_tlbwe_lo()
807 ppcemb_tlb_flush(cs, tlb); in helper_4xx_tlbwe_lo()
809 tlb->attr = val & PPC4XX_TLBLO_ATTR_MASK; in helper_4xx_tlbwe_lo()
810 tlb->RPN = val & PPC4XX_TLBLO_RPN_MASK; in helper_4xx_tlbwe_lo()
811 tlb->prot = PAGE_READ; in helper_4xx_tlbwe_lo()
813 tlb->prot |= PAGE_EXEC; in helper_4xx_tlbwe_lo()
816 tlb->prot |= PAGE_WRITE; in helper_4xx_tlbwe_lo()
821 (int)entry, tlb->RPN, tlb->EPN, tlb->size, in helper_4xx_tlbwe_lo()
822 tlb->prot & PAGE_READ ? 'r' : '-', in helper_4xx_tlbwe_lo()
823 tlb->prot & PAGE_WRITE ? 'w' : '-', in helper_4xx_tlbwe_lo()
824 tlb->prot & PAGE_EXEC ? 'x' : '-', in helper_4xx_tlbwe_lo()
825 tlb->prot & PAGE_VALID ? 'v' : '-', (int)tlb->PID); in helper_4xx_tlbwe_lo()
833 static bool mmubooke_pid_match(CPUPPCState *env, ppcemb_tlb_t *tlb) in mmubooke_pid_match() argument
835 if (tlb->PID == env->spr[SPR_BOOKE_PID]) { in mmubooke_pid_match()
842 if (env->spr[SPR_BOOKE_PID1] && tlb->PID == env->spr[SPR_BOOKE_PID1]) { in mmubooke_pid_match()
845 if (env->spr[SPR_BOOKE_PID2] && tlb->PID == env->spr[SPR_BOOKE_PID2]) { in mmubooke_pid_match()
856 ppcemb_tlb_t *tlb; in helper_440_tlbwe() local
861 tlb = &env->tlb.tlbe[entry]; in helper_440_tlbwe()
864 if ((tlb->prot & PAGE_VALID) && mmubooke_pid_match(env, tlb)) { in helper_440_tlbwe()
867 (int)entry, tlb->EPN, tlb->EPN + tlb->size); in helper_440_tlbwe()
868 ppcemb_tlb_flush(env_cpu(env), tlb); in helper_440_tlbwe()
875 tlb->EPN = value & 0xFFFFFC00; in helper_440_tlbwe()
876 tlb->size = booke_tlb_to_page_size((value >> 4) & 0xF); in helper_440_tlbwe()
877 tlb->attr &= ~0x1; in helper_440_tlbwe()
878 tlb->attr |= (value >> 8) & 1; in helper_440_tlbwe()
880 tlb->prot |= PAGE_VALID; in helper_440_tlbwe()
882 tlb->prot &= ~PAGE_VALID; in helper_440_tlbwe()
884 tlb->PID = env->spr[SPR_440_MMUCR] & 0x000000FF; in helper_440_tlbwe()
887 tlb->RPN = value & 0xFFFFFC0F; in helper_440_tlbwe()
890 tlb->attr = (tlb->attr & 0x1) | (value & 0x0000FF00); in helper_440_tlbwe()
891 tlb->prot = tlb->prot & PAGE_VALID; in helper_440_tlbwe()
893 tlb->prot |= PAGE_READ << 4; in helper_440_tlbwe()
896 tlb->prot |= PAGE_WRITE << 4; in helper_440_tlbwe()
899 tlb->prot |= PAGE_EXEC << 4; in helper_440_tlbwe()
902 tlb->prot |= PAGE_READ; in helper_440_tlbwe()
905 tlb->prot |= PAGE_WRITE; in helper_440_tlbwe()
908 tlb->prot |= PAGE_EXEC; in helper_440_tlbwe()
917 ppcemb_tlb_t *tlb; in helper_440_tlbre() local
922 tlb = &env->tlb.tlbe[entry]; in helper_440_tlbre()
927 ret = tlb->EPN; in helper_440_tlbre()
928 size = booke_page_size_to_tlb(tlb->size); in helper_440_tlbre()
933 if (tlb->attr & 0x1) { in helper_440_tlbre()
936 if (tlb->prot & PAGE_VALID) { in helper_440_tlbre()
940 env->spr[SPR_440_MMUCR] |= tlb->PID; in helper_440_tlbre()
943 ret = tlb->RPN; in helper_440_tlbre()
946 ret = tlb->attr & ~0x1; in helper_440_tlbre()
947 if (tlb->prot & (PAGE_READ << 4)) { in helper_440_tlbre()
950 if (tlb->prot & (PAGE_WRITE << 4)) { in helper_440_tlbre()
953 if (tlb->prot & (PAGE_EXEC << 4)) { in helper_440_tlbre()
956 if (tlb->prot & PAGE_READ) { in helper_440_tlbre()
959 if (tlb->prot & PAGE_WRITE) { in helper_440_tlbre()
962 if (tlb->prot & PAGE_EXEC) { in helper_440_tlbre()
982 int tlb; in booke206_cur_tlb() local
984 tlb = (env->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT; in booke206_cur_tlb()
985 tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlb]; in booke206_cur_tlb()
991 return booke206_get_tlbm(env, tlb, ea, esel); in booke206_cur_tlb()
1012 static inline void flush_page(CPUPPCState *env, ppcmas_tlb_t *tlb) in flush_page() argument
1014 if (booke206_tlb_to_page_size(env, tlb) == TARGET_PAGE_SIZE) { in flush_page()
1015 tlb_flush_page(env_cpu(env), tlb->mas2 & MAS2_EPN_MASK); in flush_page()
1024 ppcmas_tlb_t *tlb; in helper_booke206_tlbwe() local
1057 tlb = booke206_cur_tlb(env); in helper_booke206_tlbwe()
1059 if (!tlb) { in helper_booke206_tlbwe()
1079 if (tlb->mas1 & MAS1_VALID) { in helper_booke206_tlbwe()
1092 flush_page(env, tlb); in helper_booke206_tlbwe()
1095 tlb->mas7_3 = ((uint64_t)env->spr[SPR_BOOKE_MAS7] << 32) | in helper_booke206_tlbwe()
1097 tlb->mas1 = env->spr[SPR_BOOKE_MAS1]; in helper_booke206_tlbwe()
1101 booke206_fixed_size_tlbn(env, tlbn, tlb); in helper_booke206_tlbwe()
1105 tlb->mas1 &= ~MAS1_TSIZE_MASK; in helper_booke206_tlbwe()
1107 tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12; in helper_booke206_tlbwe()
1112 mask = ~(booke206_tlb_to_page_size(env, tlb) - 1); in helper_booke206_tlbwe()
1124 tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & mask; in helper_booke206_tlbwe()
1128 tlb->mas1 &= ~MAS1_IPROT; in helper_booke206_tlbwe()
1131 flush_page(env, tlb); in helper_booke206_tlbwe()
1134 static inline void booke206_tlb_to_mas(CPUPPCState *env, ppcmas_tlb_t *tlb) in booke206_tlb_to_mas() argument
1136 int tlbn = booke206_tlbm_to_tlbn(env, tlb); in booke206_tlb_to_mas()
1137 int way = booke206_tlbm_to_way(env, tlb); in booke206_tlb_to_mas()
1143 env->spr[SPR_BOOKE_MAS1] = tlb->mas1; in booke206_tlb_to_mas()
1144 env->spr[SPR_BOOKE_MAS2] = tlb->mas2; in booke206_tlb_to_mas()
1145 env->spr[SPR_BOOKE_MAS3] = tlb->mas7_3; in booke206_tlb_to_mas()
1146 env->spr[SPR_BOOKE_MAS7] = tlb->mas7_3 >> 32; in booke206_tlb_to_mas()
1151 ppcmas_tlb_t *tlb = NULL; in helper_booke206_tlbre() local
1153 tlb = booke206_cur_tlb(env); in helper_booke206_tlbre()
1154 if (!tlb) { in helper_booke206_tlbre()
1157 booke206_tlb_to_mas(env, tlb); in helper_booke206_tlbre()
1163 ppcmas_tlb_t *tlb = NULL; in helper_booke206_tlbsx() local
1175 tlb = booke206_get_tlbm(env, i, address, j); in helper_booke206_tlbsx()
1177 if (!tlb) { in helper_booke206_tlbsx()
1181 if (ppcmas_tlb_check(env, tlb, &raddr, address, spid)) { in helper_booke206_tlbsx()
1185 if (sas != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) { in helper_booke206_tlbsx()
1189 booke206_tlb_to_mas(env, tlb); in helper_booke206_tlbsx()
1223 ppcmas_tlb_t *tlb = booke206_get_tlbm(env, tlbn, ea, i); in booke206_invalidate_ea_tlb() local
1224 if (!tlb) { in booke206_invalidate_ea_tlb()
1227 mask = ~(booke206_tlb_to_page_size(env, tlb) - 1); in booke206_invalidate_ea_tlb()
1228 if (((tlb->mas2 & MAS2_EPN_MASK) == (ea & mask)) && in booke206_invalidate_ea_tlb()
1229 !(tlb->mas1 & MAS1_IPROT)) { in booke206_invalidate_ea_tlb()
1230 tlb->mas1 &= ~MAS1_VALID; in booke206_invalidate_ea_tlb()
1276 ppcmas_tlb_t *tlb = env->tlb.tlbm; in helper_booke206_tlbilx1() local
1283 if (!(tlb[j].mas1 & MAS1_IPROT) && in helper_booke206_tlbilx1()
1284 ((tlb[j].mas1 & MAS1_TID_MASK) == tid)) { in helper_booke206_tlbilx1()
1285 tlb[j].mas1 &= ~MAS1_VALID; in helper_booke206_tlbilx1()
1288 tlb += booke206_tlb_size(env, i); in helper_booke206_tlbilx1()
1296 ppcmas_tlb_t *tlb; in helper_booke206_tlbilx3() local
1312 tlb = booke206_get_tlbm(env, i, address, j); in helper_booke206_tlbilx3()
1313 if (!tlb) { in helper_booke206_tlbilx3()
1316 if ((ppcmas_tlb_check(env, tlb, NULL, address, pid) != 0) || in helper_booke206_tlbilx3()
1317 (tlb->mas1 & MAS1_IPROT) || in helper_booke206_tlbilx3()
1318 ((tlb->mas1 & MAS1_IND) != ind) || in helper_booke206_tlbilx3()
1319 ((tlb->mas8 & MAS8_TGS) != sgs)) { in helper_booke206_tlbilx3()
1322 if (mav2 && ((tlb->mas1 & MAS1_TSIZE_MASK) != size)) { in helper_booke206_tlbilx3()
1327 tlb->mas1 &= ~MAS1_VALID; in helper_booke206_tlbilx3()