context.addr = address;
if (tcg_enabled()) {
- ret = loongarch_get_addr_from_tlb(env, physical, prot, address,
- access_type, mmu_idx);
+ ret = loongarch_get_addr_from_tlb(env, &context, access_type, mmu_idx);
if (ret != TLBRET_NOMATCH) {
+ if (ret == TLBRET_MATCH) {
+ *physical = context.physical;
+ *prot = context.prot;
+ }
return ret;
}
}
MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr);
-TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical,
- int *prot, target_ulong address,
+TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env,
+ MMUContext *context,
MMUAccessType access_type, int mmu_idx);
#endif /* TARGET_LOONGARCH_TCG_LOONGARCH_H */
return loongarch_check_pte(env, context, access_type, mmu_idx);
}
-TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical,
- int *prot, vaddr address,
+TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env,
+ MMUContext *context,
MMUAccessType access_type, int mmu_idx)
{
int index, match;
- MMUContext context;
- TLBRet ret;
- context.addr = address;
- match = loongarch_tlb_search(env, address, &index);
+ match = loongarch_tlb_search(env, context->addr, &index);
if (match) {
- ret = loongarch_map_tlb_entry(env, &context, access_type, index,
- mmu_idx);
- if (ret == TLBRET_MATCH) {
- *physical = context.physical;
- *prot = context.prot;
- }
- return ret;
+ return loongarch_map_tlb_entry(env, context, access_type, index,
+ mmu_idx);
}
return TLBRET_NOMATCH;