[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7
From: |
Peter Maydell |
Subject: |
[PULL 08/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7 |
Date: |
Thu, 22 Sep 2022 17:35:05 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220822152741.1617527-8-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/ptw.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 70abcce81f9..36b108907fc 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -1513,17 +1513,16 @@ static bool pmsav7_use_background_region(ARMCPU *cpu,
ARMMMUIdx mmu_idx,
static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
MMUAccessType access_type, ARMMMUIdx mmu_idx,
- hwaddr *phys_ptr, int *prot,
- target_ulong *page_size,
+ GetPhysAddrResult *result,
ARMMMUFaultInfo *fi)
{
ARMCPU *cpu = env_archcpu(env);
int n;
bool is_user = regime_is_user(env, mmu_idx);
- *phys_ptr = address;
- *page_size = TARGET_PAGE_SIZE;
- *prot = 0;
+ result->phys = address;
+ result->page_size = TARGET_PAGE_SIZE;
+ result->prot = 0;
if (regime_translation_disabled(env, mmu_idx) ||
m_is_ppb_region(env, address)) {
@@ -1535,7 +1534,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
* which always does a direct read using address_space_ldl(), rather
* than going via this function, so we don't need to check that here.
*/
- get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
+ get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->prot);
} else { /* MPU enabled */
for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) {
/* region search */
@@ -1577,7 +1576,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
if (ranges_overlap(base, rmask,
address & TARGET_PAGE_MASK,
TARGET_PAGE_SIZE)) {
- *page_size = 1;
+ result->page_size = 1;
}
continue;
}
@@ -1615,7 +1614,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
continue;
}
if (rsize < TARGET_PAGE_BITS) {
- *page_size = 1 << rsize;
+ result->page_size = 1 << rsize;
}
break;
}
@@ -1626,7 +1625,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
fi->type = ARMFault_Background;
return true;
}
- get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
+ get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->prot);
} else { /* a MPU hit! */
uint32_t ap = extract32(env->pmsav7.dracr[n], 8, 3);
uint32_t xn = extract32(env->pmsav7.dracr[n], 12, 1);
@@ -1643,16 +1642,16 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
case 5:
break; /* no access */
case 3:
- *prot |= PAGE_WRITE;
+ result->prot |= PAGE_WRITE;
/* fall through */
case 2:
case 6:
- *prot |= PAGE_READ | PAGE_EXEC;
+ result->prot |= PAGE_READ | PAGE_EXEC;
break;
case 7:
/* for v7M, same as 6; for R profile a reserved value */
if (arm_feature(env, ARM_FEATURE_M)) {
- *prot |= PAGE_READ | PAGE_EXEC;
+ result->prot |= PAGE_READ | PAGE_EXEC;
break;
}
/* fall through */
@@ -1668,16 +1667,16 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
case 1:
case 2:
case 3:
- *prot |= PAGE_WRITE;
+ result->prot |= PAGE_WRITE;
/* fall through */
case 5:
case 6:
- *prot |= PAGE_READ | PAGE_EXEC;
+ result->prot |= PAGE_READ | PAGE_EXEC;
break;
case 7:
/* for v7M, same as 6; for R profile a reserved value */
if (arm_feature(env, ARM_FEATURE_M)) {
- *prot |= PAGE_READ | PAGE_EXEC;
+ result->prot |= PAGE_READ | PAGE_EXEC;
break;
}
/* fall through */
@@ -1690,14 +1689,14 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
uint32_t address,
/* execute never */
if (xn) {
- *prot &= ~PAGE_EXEC;
+ result->prot &= ~PAGE_EXEC;
}
}
}
fi->type = ARMFault_Permission;
fi->level = 1;
- return !(*prot & (1 << access_type));
+ return !(result->prot & (1 << access_type));
}
bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
@@ -2422,8 +2421,7 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
} else if (arm_feature(env, ARM_FEATURE_V7)) {
/* PMSAv7 */
ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,
- &result->phys, &result->prot,
- &result->page_size, fi);
+ result, fi);
} else {
/* Pre-v7 MPU */
ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx,
--
2.25.1
- [PULL 14/39] target/arm: Add is_secure parameter to get_phys_addr_v5, (continued)
- [PULL 14/39] target/arm: Add is_secure parameter to get_phys_addr_v5, Peter Maydell, 2022/09/22
- [PULL 17/39] target/arm: Add is_secure parameter to pmsav7_use_background_region, Peter Maydell, 2022/09/22
- [PULL 19/39] target/arm: Add is_secure parameter to get_phys_addr_pmsav5, Peter Maydell, 2022/09/22
- [PULL 27/39] hw/ppc/pnv: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 38/39] configure: Check mkdir result directly, not via $?, Peter Maydell, 2022/09/22
- [PULL 34/39] configure: Remove unused meson_args variable, Peter Maydell, 2022/09/22
- [PULL 39/39] configure: Avoid use of 'local' as it is non-POSIX, Peter Maydell, 2022/09/22
- [PULL 33/39] configure: Remove unused python_version variable, Peter Maydell, 2022/09/22
- [PULL 02/39] target/arm: Fix alignment for VLD4.32, Peter Maydell, 2022/09/22
- [PULL 11/39] target/arm: Remove is_subpage argument to pmsav8_mpu_lookup, Peter Maydell, 2022/09/22
- [PULL 08/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7,
Peter Maydell <=
- [PULL 04/39] target/arm: Use GetPhysAddrResult in get_phys_addr_lpae, Peter Maydell, 2022/09/22
- [PULL 09/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav8, Peter Maydell, 2022/09/22
- [PULL 12/39] target/arm: Add is_secure parameter to v8m_security_lookup, Peter Maydell, 2022/09/22
- [PULL 16/39] target/arm: Add secure parameter to get_phys_addr_pmsav8, Peter Maydell, 2022/09/22
- [PULL 01/39] hw/net/can: fix Xilinx ZynqMP CAN RX FIFO logic, Peter Maydell, 2022/09/22
- [PULL 31/39] ui/curses: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 10/39] target/arm: Use GetPhysAddrResult in pmsav8_mpu_lookup, Peter Maydell, 2022/09/22
- [PULL 32/39] tests/unit/test-vmstate: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 21/39] hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level, Peter Maydell, 2022/09/22
- [PULL 23/39] chardev/baum: Use definitions to avoid dynamic stack allocation, Peter Maydell, 2022/09/22