[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/39] target/arm: Use GetPhysAddrResult in get_phys_addr_v5
From: |
Peter Maydell |
Subject: |
[PULL 06/39] target/arm: Use GetPhysAddrResult in get_phys_addr_v5 |
Date: |
Thu, 22 Sep 2022 17:35:03 +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-6-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 | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 600d9e6650d..4e2476278e1 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -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);
}
}
--
2.25.1
- [PULL 00/39] target-arm queue, Peter Maydell, 2022/09/22
- [PULL 05/39] target/arm: Use GetPhysAddrResult in get_phys_addr_v6, Peter Maydell, 2022/09/22
- [PULL 07/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav5, Peter Maydell, 2022/09/22
- [PULL 03/39] target/arm: Create GetPhysAddrResult, Peter Maydell, 2022/09/22
- [PULL 15/39] target/arm: Add is_secure parameter to get_phys_addr_v6, Peter Maydell, 2022/09/22
- [PULL 22/39] chardev/baum: Replace magic values by X_MAX / Y_MAX definitions, Peter Maydell, 2022/09/22
- [PULL 06/39] target/arm: Use GetPhysAddrResult in get_phys_addr_v5,
Peter Maydell <=
- [PULL 13/39] target/arm: Add secure parameter to pmsav8_mpu_lookup, Peter Maydell, 2022/09/22
- [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