[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/28] target/arm: Move get_level1_table_address to ptw.c
From: |
Richard Henderson |
Subject: |
[PATCH 13/28] target/arm: Move get_level1_table_address to ptw.c |
Date: |
Fri, 3 Jun 2022 21:05:52 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/ptw.h | 4 ++--
target/arm/helper.c | 26 +-------------------------
target/arm/ptw.c | 23 +++++++++++++++++++++++
3 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/target/arm/ptw.h b/target/arm/ptw.h
index 6c47a57599..dd6fb93f33 100644
--- a/target/arm/ptw.h
+++ b/target/arm/ptw.h
@@ -18,11 +18,11 @@ uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool
is_secure,
bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx);
bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx);
+uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn);
+
ARMCacheAttrs combine_cacheattrs(CPUARMState *env,
ARMCacheAttrs s1, ARMCacheAttrs s2);
-bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
- uint32_t *table, uint32_t address);
int ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx,
int ap, int domain_prot);
int simple_ap_to_rw_prot_is_user(int ap, bool is_user);
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 937971730c..50c4576544 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10446,8 +10446,7 @@ static inline bool
regime_translation_big_endian(CPUARMState *env,
}
/* Return the TTBR associated with this translation regime */
-static inline uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx,
- int ttbrn)
+uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn)
{
if (mmu_idx == ARMMMUIdx_Stage2) {
return env->cp15.vttbr_el2;
@@ -10738,29 +10737,6 @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx
mmu_idx, bool is_aa64,
return prot_rw | PAGE_EXEC;
}
-bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
- uint32_t *table, uint32_t address)
-{
- /* Note that we can only get here for an AArch32 PL0/PL1 lookup */
- TCR *tcr = regime_tcr(env, mmu_idx);
-
- if (address & tcr->mask) {
- if (tcr->raw_tcr & TTBCR_PD1) {
- /* Translation table walk disabled for TTBR1 */
- return false;
- }
- *table = regime_ttbr(env, mmu_idx, 1) & 0xffffc000;
- } else {
- if (tcr->raw_tcr & TTBCR_PD0) {
- /* Translation table walk disabled for TTBR0 */
- return false;
- }
- *table = regime_ttbr(env, mmu_idx, 0) & tcr->base_mask;
- }
- *table |= (address >> 18) & 0x3ffc;
- return true;
-}
-
static bool ptw_attrs_are_device(CPUARMState *env, ARMCacheAttrs cacheattrs)
{
/*
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 32ba2e5e8b..5737a3976b 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -15,6 +15,29 @@
#include "ptw.h"
+static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
+ uint32_t *table, uint32_t address)
+{
+ /* Note that we can only get here for an AArch32 PL0/PL1 lookup */
+ TCR *tcr = regime_tcr(env, mmu_idx);
+
+ if (address & tcr->mask) {
+ if (tcr->raw_tcr & TTBCR_PD1) {
+ /* Translation table walk disabled for TTBR1 */
+ return false;
+ }
+ *table = regime_ttbr(env, mmu_idx, 1) & 0xffffc000;
+ } else {
+ if (tcr->raw_tcr & TTBCR_PD0) {
+ /* Translation table walk disabled for TTBR0 */
+ return false;
+ }
+ *table = regime_ttbr(env, mmu_idx, 0) & tcr->base_mask;
+ }
+ *table |= (address >> 18) & 0x3ffc;
+ return true;
+}
+
static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
MMUAccessType access_type, ARMMMUIdx mmu_idx,
hwaddr *phys_ptr, int *prot,
--
2.34.1
- [PATCH 01/28] target/arm: Move stage_1_mmu_idx decl to internals.h, (continued)
- [PATCH 01/28] target/arm: Move stage_1_mmu_idx decl to internals.h, Richard Henderson, 2022/06/04
- [PATCH 04/28] target/arm: Move get_phys_addr_v6 to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 05/28] target/arm: Move get_phys_addr_pmsav5 to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 07/28] target/arm: Move get_phys_addr_pmsav7 to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 02/28] target/arm: Move get_phys_addr to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 03/28] target/arm: Move get_phys_addr_v5 to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 10/28] target/arm: Move pmsav7_use_background_region to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 11/28] target/arm: Move v8m_security_lookup to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 13/28] target/arm: Move get_level1_table_address to ptw.c,
Richard Henderson <=
- [PATCH 14/28] target/arm: Move combine_cacheattrs and subroutines to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 06/28] target/arm: Move get_phys_addr_pmsav7_default to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 08/28] target/arm: Move get_phys_addr_pmsav8 to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 09/28] target/arm: Move pmsav8_mpu_lookup to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 12/28] target/arm: Move m_is_{ppb,system}_region to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 16/28] target/arm: Move arm_{ldl,ldq}_ptw to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 17/28] target/arm: Move {arm_s1_, }regime_using_lpae_format to tlb_helper.c, Richard Henderson, 2022/06/04
- [PATCH 18/28] target/arm: Move arm_pamax, pamax_map into ptw.c, Richard Henderson, 2022/06/04
- [PATCH 20/28] target/arm: Move check_s2_mmu_setup to ptw.c, Richard Henderson, 2022/06/04
- [PATCH 15/28] target/arm: Move get_phys_addr_lpae to ptw.c, Richard Henderson, 2022/06/04