diff mbox

[07/11] target-arm: Add Hyp mode checks to bad_mode_switch()

Message ID 1455556977-3644-8-git-send-email-peter.maydell@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Maydell Feb. 15, 2016, 5:22 p.m. UTC
We don't actually support Hyp mode yet, but add the correct
checks for it to the bad_mode_switch() function for completeness.

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

Comments

Sergey Fedorov Feb. 18, 2016, 5:43 p.m. UTC | #1
On 15.02.2016 20:22, Peter Maydell wrote:
> We don't actually support Hyp mode yet, but add the correct
> checks for it to the bad_mode_switch() function for completeness.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com>

> ---
>  target-arm/helper.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 37b5439..4074b97 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -5184,6 +5184,9 @@ static int bad_mode_switch(CPUARMState *env, int mode)
>           * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.)
>           */
>          return 0;
> +    case ARM_CPU_MODE_HYP:
> +        return !arm_feature(env, ARM_FEATURE_EL2)
> +            || arm_current_el(env) < 2 || arm_is_secure(env);
>      case ARM_CPU_MODE_MON:
>          return !arm_is_secure(env);
>      default:
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 37b5439..4074b97 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5184,6 +5184,9 @@  static int bad_mode_switch(CPUARMState *env, int mode)
          * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.)
          */
         return 0;
+    case ARM_CPU_MODE_HYP:
+        return !arm_feature(env, ARM_FEATURE_EL2)
+            || arm_current_el(env) < 2 || arm_is_secure(env);
     case ARM_CPU_MODE_MON:
         return !arm_is_secure(env);
     default: