Patchwork [8/8] target-arm: Translate with user-state from TB flags, not CPUState

login
register
mail settings
Submitter Peter Maydell
Date Jan. 11, 2011, 10:12 p.m.
Message ID <1294783938-19629-9-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/78462/
State New
Headers show

Comments

Peter Maydell - Jan. 11, 2011, 10:12 p.m.
When translating, get the user/priv state from the TB flags, not
the CPUState.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/translate.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Aurelien Jarno - Jan. 12, 2011, 10:22 a.m.
On Tue, Jan 11, 2011 at 10:12:18PM +0000, Peter Maydell wrote:
> When translating, get the user/priv state from the TB flags, not
> the CPUState.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/translate.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
 
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index 4fe202d..aa3c60a 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -9078,11 +9078,7 @@ static inline void gen_intermediate_code_internal(CPUState *env,
>      dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1;
>      dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4;
>  #if !defined(CONFIG_USER_ONLY)
> -    if (IS_M(env)) {
> -        dc->user = ((env->v7m.exception == 0) && (env->v7m.control & 1));
> -    } else {
> -        dc->user = (env->uncached_cpsr & 0x1f) == ARM_CPU_MODE_USR;
> -    }
> +    dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0);
>  #endif
>      dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags);
>      dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags);
> -- 
> 1.6.3.3
> 
> 
>

Patch

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 4fe202d..aa3c60a 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9078,11 +9078,7 @@  static inline void gen_intermediate_code_internal(CPUState *env,
     dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1;
     dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4;
 #if !defined(CONFIG_USER_ONLY)
-    if (IS_M(env)) {
-        dc->user = ((env->v7m.exception == 0) && (env->v7m.control & 1));
-    } else {
-        dc->user = (env->uncached_cpsr & 0x1f) == ARM_CPU_MODE_USR;
-    }
+    dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0);
 #endif
     dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags);
     dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags);