Patchwork [5/5] target-arm: Thread ID Registers are ARMv6K +

login
register
mail settings
Submitter Riku Voipio
Date Jan. 26, 2010, 4 p.m.
Message ID <1264521604-2020-6-git-send-email-riku.voipio@iki.fi>
Download mbox | patch
Permalink /patch/43713/
State New
Headers show

Comments

Riku Voipio - Jan. 26, 2010, 4 p.m.
From: Riku Voipio <riku.voipio@nokia.com>

Change the system-emulation code also to only support accessing
the cp15.c13 Thread ID registers on ARMv6K and newer.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
---
 target-arm/helper.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Laurent Desnogues - Jan. 26, 2010, 4:28 p.m.
On Tue, Jan 26, 2010 at 5:00 PM, Riku Voipio <riku.voipio@iki.fi> wrote:
> From: Riku Voipio <riku.voipio@nokia.com>
>
> Change the system-emulation code also to only support accessing
> the cp15.c13 Thread ID registers on ARMv6K and newer.
>
> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
> ---
>  target-arm/helper.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 68578ce..1245d9d 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -1517,12 +1517,18 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
>             env->cp15.c13_context = val;
>             break;
>         case 2:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             env->cp15.c13_tls1 = val;
>             break;
>         case 3:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             env->cp15.c13_tls2 = val;
>             break;
>         case 4:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             env->cp15.c13_tls3 = val;
>             break;
>         default:
> @@ -1805,10 +1811,16 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
>         case 1:
>             return env->cp15.c13_context;
>         case 2:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             return env->cp15.c13_tls1;
>         case 3:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             return env->cp15.c13_tls2;
>         case 4:
> +            if (!arm_feature(env, ARM_FEATURE_V6K))
> +                goto bad_reg;
>             return env->cp15.c13_tls3;
>         default:
>             goto bad_reg;

Same question as for user mode :-)


Laurent

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 68578ce..1245d9d 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1517,12 +1517,18 @@  void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
             env->cp15.c13_context = val;
             break;
         case 2:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             env->cp15.c13_tls1 = val;
             break;
         case 3:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             env->cp15.c13_tls2 = val;
             break;
         case 4:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             env->cp15.c13_tls3 = val;
             break;
         default:
@@ -1805,10 +1811,16 @@  uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
         case 1:
             return env->cp15.c13_context;
         case 2:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             return env->cp15.c13_tls1;
         case 3:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             return env->cp15.c13_tls2;
         case 4:
+            if (!arm_feature(env, ARM_FEATURE_V6K))
+                goto bad_reg;
             return env->cp15.c13_tls3;
         default:
             goto bad_reg;