diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-02-05 13:37:23 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-02-05 13:37:23 +0000 |
commit | 6d54ed3c93f1e05a483201b087142998381c9be8 (patch) | |
tree | f1fe79f2a8046dbe7eda9edd34a7e5941249b979 /target-arm/cpu.h | |
parent | 8f3ae2ae2d02727f6d56610c09d7535e43650dd4 (diff) |
target-arm: Make arm_current_el() return sensible values for M profile
Although M profile doesn't have the same concept of exception level
as A profile, it does have a notion of privileged versus not, which
we currently track in the privmode TB flag. Support returning this
information if arm_current_el() is called on an M profile core, so
that we can identify the correct MMU index to use (and put the MMU
index in the TB flags) without having to special-case M profile.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Greg Bellows <greg.bellows@linaro.org>
Diffstat (limited to 'target-arm/cpu.h')
-rw-r--r-- | target-arm/cpu.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 97f0c13dc3..d6e0d4debd 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1218,6 +1218,10 @@ static inline bool cptype_valid(int cptype) */ static inline int arm_current_el(CPUARMState *env) { + if (arm_feature(env, ARM_FEATURE_M)) { + return !((env->v7m.exception == 0) && (env->v7m.control & 1)); + } + if (is_a64(env)) { return extract32(env->pstate, 2, 2); } |