* [Qemu-devel] [PATCH v2] target/arm: Forbid unprivileged mode for M Baseline
@ 2018-07-05 22:26 Julia Suvorova
2018-07-06 14:15 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Julia Suvorova @ 2018-07-05 22:26 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefan Hajnoczi, Joel Stanley, Jim Mussared,
Steffen Görtz, Julia Suvorova
MSR handling is the only place where CONTROL.nPRIV is modified.
Signed-off-by: Julia Suvorova <jusual@mail.ru>
---
v2:
* Add the check in the CONTROL_NS case
target/arm/helper.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 5ee229eb35..2343aa5069 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10686,8 +10686,10 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
write_v7m_control_spsel_for_secstate(env,
val & R_V7M_CONTROL_SPSEL_MASK,
M_REG_NS);
- env->v7m.control[M_REG_NS] &= ~R_V7M_CONTROL_NPRIV_MASK;
- env->v7m.control[M_REG_NS] |= val & R_V7M_CONTROL_NPRIV_MASK;
+ if (arm_feature(env, ARM_FEATURE_M_MAIN)) {
+ env->v7m.control[M_REG_NS] &= ~R_V7M_CONTROL_NPRIV_MASK;
+ env->v7m.control[M_REG_NS] |= val & R_V7M_CONTROL_NPRIV_MASK;
+ }
return;
case 0x98: /* SP_NS */
{
@@ -10781,8 +10783,10 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
!arm_v7m_is_handler_mode(env)) {
write_v7m_control_spsel(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0);
}
- env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK;
- env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK;
+ if (arm_feature(env, ARM_FEATURE_M_MAIN)) {
+ env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK;
+ env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK;
+ }
break;
default:
bad_reg:
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/arm: Forbid unprivileged mode for M Baseline
2018-07-05 22:26 [Qemu-devel] [PATCH v2] target/arm: Forbid unprivileged mode for M Baseline Julia Suvorova
@ 2018-07-06 14:15 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2018-07-06 14:15 UTC (permalink / raw)
To: Julia Suvorova
Cc: QEMU Developers, Stefan Hajnoczi, Joel Stanley, Jim Mussared,
Steffen Görtz
On 5 July 2018 at 23:26, Julia Suvorova <jusual@mail.ru> wrote:
> MSR handling is the only place where CONTROL.nPRIV is modified.
>
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
> v2:
> * Add the check in the CONTROL_NS case
>
> target/arm/helper.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
As we're now in freeze for the QEMU 3.0 release, I've added this
patch to a branch I'm keeping with arm-related patches intended
to go into 3.1. You can find it at
https://git.linaro.org/people/peter.maydell/qemu-arm.git target-arm.for-3.1
but note that it will be rebased in future so be careful
if you base anything on it. (You might find it easier to just
ignore it ;-))
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-06 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 22:26 [Qemu-devel] [PATCH v2] target/arm: Forbid unprivileged mode for M Baseline Julia Suvorova
2018-07-06 14:15 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.