diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-10-03 17:23:14 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-10-10 14:52:25 +0100 |
commit | 3c003f7029eb322c15f137b33af1120096e14f4d (patch) | |
tree | 8e6e7679d867fae7f9836dd60c50a8acb521c742 /target/arm/internals.h | |
parent | 104f703d93c9f12984a165985af653f83527c84e (diff) | |
download | qemu-3c003f7029eb322c15f137b33af1120096e14f4d.zip qemu-3c003f7029eb322c15f137b33af1120096e14f4d.tar.gz qemu-3c003f7029eb322c15f137b33af1120096e14f4d.tar.bz2 |
target/arm: Use ARMGranuleSize in ARMVAParameters
Now we have an enum for the granule size, use it in the
ARMVAParameters struct instead of the using16k/using64k bools.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221003162315.2833797-3-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/internals.h')
-rw-r--r-- | target/arm/internals.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/target/arm/internals.h b/target/arm/internals.h index 6166ac0..9566364 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1007,6 +1007,26 @@ typedef enum ARMGranuleSize { GranInvalid, } ARMGranuleSize; +/** + * arm_granule_bits: Return address size of the granule in bits + * + * Return the address size of the granule in bits. This corresponds + * to the pseudocode TGxGranuleBits(). + */ +static inline int arm_granule_bits(ARMGranuleSize gran) +{ + switch (gran) { + case Gran64K: + return 16; + case Gran16K: + return 14; + case Gran4K: + return 12; + default: + g_assert_not_reached(); + } +} + /* * Parameters of a given virtual address, as extracted from the * translation control register (TCR) for a given regime. @@ -1019,10 +1039,9 @@ typedef struct ARMVAParameters { bool tbi : 1; bool epd : 1; bool hpd : 1; - bool using16k : 1; - bool using64k : 1; bool tsz_oob : 1; /* tsz has been clamped to legal range */ bool ds : 1; + ARMGranuleSize gran : 2; } ARMVAParameters; ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, |