diff mbox

[03/24] target-arm: Restrict check_ap() use of S and R bits to v6 and earlier

Message ID 1390335150-13470-4-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Jan. 21, 2014, 8:12 p.m. UTC
The SCTLR bits S and R (8 and 9) only exist in ARMv6 and earlier.
In ARMv7 these bits RAZ, and in ARMv8 they are reassigned. Guard
the use of them in check_ap() so that we don't get incorrect results
for ARMv8 CPUs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/helper.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peter Crosthwaite Jan. 24, 2014, 11:28 p.m. UTC | #1
On Wed, Jan 22, 2014 at 6:12 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> The SCTLR bits S and R (8 and 9) only exist in ARMv6 and earlier.
> In ARMv7 these bits RAZ, and in ARMv8 they are reassigned. Guard
> the use of them in check_ap() so that we don't get incorrect results
> for ARMv8 CPUs.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> ---
>  target-arm/helper.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 792953e..205e36a 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -2765,6 +2765,9 @@ static inline int check_ap(CPUARMState *env, int ap, int domain_prot,
>
>    switch (ap) {
>    case 0:
> +      if (arm_feature(env, ARM_FEATURE_V7)) {
> +          return 0;
> +      }
>        if (access_type == 1)
>            return 0;
>        switch (env->cp15.c1_sys & (SCTLR_S | SCTLR_R)) {
> --
> 1.8.5
>
>
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 792953e..205e36a 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -2765,6 +2765,9 @@  static inline int check_ap(CPUARMState *env, int ap, int domain_prot,
 
   switch (ap) {
   case 0:
+      if (arm_feature(env, ARM_FEATURE_V7)) {
+          return 0;
+      }
       if (access_type == 1)
           return 0;
       switch (env->cp15.c1_sys & (SCTLR_S | SCTLR_R)) {