target/arm: Use GetPhysAddrResult in get_phys_addr_v5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220822152741.1617527-6-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
60a6a180b1
commit
51d98ce2cb
@ -414,9 +414,7 @@ static int simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)
|
||||
|
||||
static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
MMUAccessType access_type, ARMMMUIdx mmu_idx,
|
||||
hwaddr *phys_ptr, int *prot,
|
||||
target_ulong *page_size,
|
||||
ARMMMUFaultInfo *fi)
|
||||
GetPhysAddrResult *result, ARMMMUFaultInfo *fi)
|
||||
{
|
||||
int level = 1;
|
||||
uint32_t table;
|
||||
@ -464,7 +462,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
/* 1Mb section. */
|
||||
phys_addr = (desc & 0xfff00000) | (address & 0x000fffff);
|
||||
ap = (desc >> 10) & 3;
|
||||
*page_size = 1024 * 1024;
|
||||
result->page_size = 1024 * 1024;
|
||||
} else {
|
||||
/* Lookup l2 entry. */
|
||||
if (type == 1) {
|
||||
@ -486,12 +484,12 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
case 1: /* 64k page. */
|
||||
phys_addr = (desc & 0xffff0000) | (address & 0xffff);
|
||||
ap = (desc >> (4 + ((address >> 13) & 6))) & 3;
|
||||
*page_size = 0x10000;
|
||||
result->page_size = 0x10000;
|
||||
break;
|
||||
case 2: /* 4k page. */
|
||||
phys_addr = (desc & 0xfffff000) | (address & 0xfff);
|
||||
ap = (desc >> (4 + ((address >> 9) & 6))) & 3;
|
||||
*page_size = 0x1000;
|
||||
result->page_size = 0x1000;
|
||||
break;
|
||||
case 3: /* 1k page, or ARMv6/XScale "extended small (4k) page" */
|
||||
if (type == 1) {
|
||||
@ -499,7 +497,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
if (arm_feature(env, ARM_FEATURE_XSCALE)
|
||||
|| arm_feature(env, ARM_FEATURE_V6)) {
|
||||
phys_addr = (desc & 0xfffff000) | (address & 0xfff);
|
||||
*page_size = 0x1000;
|
||||
result->page_size = 0x1000;
|
||||
} else {
|
||||
/*
|
||||
* UNPREDICTABLE in ARMv5; we choose to take a
|
||||
@ -510,7 +508,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
}
|
||||
} else {
|
||||
phys_addr = (desc & 0xfffffc00) | (address & 0x3ff);
|
||||
*page_size = 0x400;
|
||||
result->page_size = 0x400;
|
||||
}
|
||||
ap = (desc >> 4) & 3;
|
||||
break;
|
||||
@ -519,14 +517,14 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
*prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot);
|
||||
*prot |= *prot ? PAGE_EXEC : 0;
|
||||
if (!(*prot & (1 << access_type))) {
|
||||
result->prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot);
|
||||
result->prot |= result->prot ? PAGE_EXEC : 0;
|
||||
if (!(result->prot & (1 << access_type))) {
|
||||
/* Access permission fault. */
|
||||
fi->type = ARMFault_Permission;
|
||||
goto do_fault;
|
||||
}
|
||||
*phys_ptr = phys_addr;
|
||||
result->phys = phys_addr;
|
||||
return false;
|
||||
do_fault:
|
||||
fi->domain = domain;
|
||||
@ -2520,8 +2518,7 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
|
||||
result, fi);
|
||||
} else {
|
||||
return get_phys_addr_v5(env, address, access_type, mmu_idx,
|
||||
&result->phys, &result->prot,
|
||||
&result->page_size, fi);
|
||||
result, fi);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user