target/loongarch: Use MMUContext in loongarch_get_addr_from_tlb
With function loongarch_get_addr_from_tlb(), parameter MMUContext is added and remove parameter physical, prot and address. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
36055cf414
commit
35fc0ec73c
3 changed files with 12 additions and 17 deletions
|
|
@ -173,9 +173,12 @@ static TLBRet loongarch_map_address(CPULoongArchState *env, hwaddr *physical,
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||
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 */
|
||||
|
|
|
|||
|
|
@ -663,24 +663,16 @@ static TLBRet loongarch_map_tlb_entry(CPULoongArchState *env,
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue