diff mbox

[v4,06/21] target-arm: Use a 1:1 mapping between EL and MMU index

Message ID 1400805738-11889-7-git-send-email-edgar.iglesias@gmail.com
State New
Headers show

Commit Message

Edgar E. Iglesias May 23, 2014, 12:42 a.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
 target-arm/cpu.h       | 8 ++++----
 target-arm/translate.h | 6 +-----
 2 files changed, 5 insertions(+), 9 deletions(-)

Comments

Peter Maydell May 23, 2014, 2:04 p.m. UTC | #1
On 23 May 2014 01:42, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> ---
>  target-arm/cpu.h       | 8 ++++----
>  target-arm/translate.h | 6 +-----
>  2 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 11b7a0b..62d85ff 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -1080,12 +1080,12 @@ static inline CPUARMState *cpu_init(const char *cpu_model)
>  #define cpu_list arm_cpu_list
>
>  /* MMU modes definitions */
> -#define MMU_MODE0_SUFFIX _kernel
> -#define MMU_MODE1_SUFFIX _user
> -#define MMU_USER_IDX 1
> +#define MMU_MODE0_SUFFIX _user
> +#define MMU_MODE1_SUFFIX _kernel
> +#define MMU_USER_IDX 0
>  static inline int cpu_mmu_index (CPUARMState *env)
>  {
> -    return arm_current_pl(env) ? 0 : 1;
> +    return arm_current_pl(env);
>  }
>
>  #include "exec/cpu-all.h"
> diff --git a/target-arm/translate.h b/target-arm/translate.h
> index 8737af0..31a0104 100644
> --- a/target-arm/translate.h
> +++ b/target-arm/translate.h
> @@ -54,11 +54,7 @@ static inline int arm_dc_feature(DisasContext *dc, int feature)
>
>  static inline int get_mem_index(DisasContext *s)
>  {
> -#ifdef CONFIG_USER_ONLY
> -    return 1;
> -#else
> -    return s->user;
> -#endif
> +    return s->current_pl;
>  }
>
>  /* target-specific extra values for is_jmp */
> --
> 1.8.3.2

I have a 32-bit test image which fails to boot (kernel
gets a Data Abort fairly early in bootup) after this
commit is applied. I think we must have missed something...

thanks
-- PMM
diff mbox

Patch

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 11b7a0b..62d85ff 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1080,12 +1080,12 @@  static inline CPUARMState *cpu_init(const char *cpu_model)
 #define cpu_list arm_cpu_list
 
 /* MMU modes definitions */
-#define MMU_MODE0_SUFFIX _kernel
-#define MMU_MODE1_SUFFIX _user
-#define MMU_USER_IDX 1
+#define MMU_MODE0_SUFFIX _user
+#define MMU_MODE1_SUFFIX _kernel
+#define MMU_USER_IDX 0
 static inline int cpu_mmu_index (CPUARMState *env)
 {
-    return arm_current_pl(env) ? 0 : 1;
+    return arm_current_pl(env);
 }
 
 #include "exec/cpu-all.h"
diff --git a/target-arm/translate.h b/target-arm/translate.h
index 8737af0..31a0104 100644
--- a/target-arm/translate.h
+++ b/target-arm/translate.h
@@ -54,11 +54,7 @@  static inline int arm_dc_feature(DisasContext *dc, int feature)
 
 static inline int get_mem_index(DisasContext *s)
 {
-#ifdef CONFIG_USER_ONLY
-    return 1;
-#else
-    return s->user;
-#endif
+    return s->current_pl;
 }
 
 /* target-specific extra values for is_jmp */