diff mbox series

[v4,17/40] target/arm: Tidy ARMMMUIdx m-profile definitions

Message ID 20191203022937.1474-18-richard.henderson@linaro.org
State Superseded
Headers show
Series target/arm: Implement ARMv8.1-VHE | expand

Commit Message

Richard Henderson Dec. 3, 2019, 2:29 a.m. UTC
Replace the magic numbers with the relevant ARM_MMU_IDX_M_* constants.
Keep the definitions short by referencing previous symbols.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/cpu.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.17.1

Comments

Philippe Mathieu-Daudé Dec. 3, 2019, 6:27 a.m. UTC | #1
On 12/3/19 3:29 AM, Richard Henderson wrote:
> Replace the magic numbers with the relevant ARM_MMU_IDX_M_* constants.

> Keep the definitions short by referencing previous symbols.


Nice trick :)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


> 

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>   target/arm/cpu.h | 16 ++++++++--------

>   1 file changed, 8 insertions(+), 8 deletions(-)

> 

> diff --git a/target/arm/cpu.h b/target/arm/cpu.h

> index 6ba5126852..015301e93a 100644

> --- a/target/arm/cpu.h

> +++ b/target/arm/cpu.h

> @@ -2871,14 +2871,14 @@ typedef enum ARMMMUIdx {

>       ARMMMUIdx_SE0 = 4 | ARM_MMU_IDX_A,

>       ARMMMUIdx_SE1 = 5 | ARM_MMU_IDX_A,

>       ARMMMUIdx_Stage2 = 6 | ARM_MMU_IDX_A,

> -    ARMMMUIdx_MUser = 0 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MPriv = 1 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MUserNegPri = 2 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MPrivNegPri = 3 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MSUser = 4 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MSPriv = 5 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MSUserNegPri = 6 | ARM_MMU_IDX_M,

> -    ARMMMUIdx_MSPrivNegPri = 7 | ARM_MMU_IDX_M,

> +    ARMMMUIdx_MUser = ARM_MMU_IDX_M,

> +    ARMMMUIdx_MPriv = ARM_MMU_IDX_M | ARM_MMU_IDX_M_PRIV,

> +    ARMMMUIdx_MUserNegPri = ARMMMUIdx_MUser | ARM_MMU_IDX_M_NEGPRI,

> +    ARMMMUIdx_MPrivNegPri = ARMMMUIdx_MPriv | ARM_MMU_IDX_M_NEGPRI,

> +    ARMMMUIdx_MSUser = ARMMMUIdx_MUser | ARM_MMU_IDX_M_S,

> +    ARMMMUIdx_MSPriv = ARMMMUIdx_MPriv | ARM_MMU_IDX_M_S,

> +    ARMMMUIdx_MSUserNegPri = ARMMMUIdx_MUserNegPri | ARM_MMU_IDX_M_S,

> +    ARMMMUIdx_MSPrivNegPri = ARMMMUIdx_MPrivNegPri | ARM_MMU_IDX_M_S,

>       /* Indexes below here don't have TLBs and are used only for AT system

>        * instructions or for the first stage of an S12 page table walk.

>        */

>
diff mbox series

Patch

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 6ba5126852..015301e93a 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2871,14 +2871,14 @@  typedef enum ARMMMUIdx {
     ARMMMUIdx_SE0 = 4 | ARM_MMU_IDX_A,
     ARMMMUIdx_SE1 = 5 | ARM_MMU_IDX_A,
     ARMMMUIdx_Stage2 = 6 | ARM_MMU_IDX_A,
-    ARMMMUIdx_MUser = 0 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MPriv = 1 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MUserNegPri = 2 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MPrivNegPri = 3 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MSUser = 4 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MSPriv = 5 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MSUserNegPri = 6 | ARM_MMU_IDX_M,
-    ARMMMUIdx_MSPrivNegPri = 7 | ARM_MMU_IDX_M,
+    ARMMMUIdx_MUser = ARM_MMU_IDX_M,
+    ARMMMUIdx_MPriv = ARM_MMU_IDX_M | ARM_MMU_IDX_M_PRIV,
+    ARMMMUIdx_MUserNegPri = ARMMMUIdx_MUser | ARM_MMU_IDX_M_NEGPRI,
+    ARMMMUIdx_MPrivNegPri = ARMMMUIdx_MPriv | ARM_MMU_IDX_M_NEGPRI,
+    ARMMMUIdx_MSUser = ARMMMUIdx_MUser | ARM_MMU_IDX_M_S,
+    ARMMMUIdx_MSPriv = ARMMMUIdx_MPriv | ARM_MMU_IDX_M_S,
+    ARMMMUIdx_MSUserNegPri = ARMMMUIdx_MUserNegPri | ARM_MMU_IDX_M_S,
+    ARMMMUIdx_MSPrivNegPri = ARMMMUIdx_MPrivNegPri | ARM_MMU_IDX_M_S,
     /* Indexes below here don't have TLBs and are used only for AT system
      * instructions or for the first stage of an S12 page table walk.
      */