From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 6/7] target-arm: Set privileged bit in TB flags correctly for M profile
Date: Fri, 7 Jan 2011 15:06:33 +0000 [thread overview]
Message-ID: <1294412794-25573-7-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1294412794-25573-1-git-send-email-peter.maydell@linaro.org>
M profile ARM cores don't have a CPSR mode field. Set the bit in the
TB flags that indicates non-user mode correctly for these cores.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/cpu.h | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 340933e..3a2d141 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -443,12 +443,27 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
target_ulong *cs_base, int *flags)
{
+ int privmode;
*pc = env->regs[15];
*cs_base = 0;
+ /* flags word usage:
+ * [0] thumbstate
+ * [3..1] vec_len
+ * [5..4] vec_stride
+ * [6] privileged (ie not user) mode
+ * [7] VFP enable bit
+ * [15..8] condexec bits
+ */
*flags = env->thumb | (env->vfp.vec_len << 1)
| (env->vfp.vec_stride << 4) | (env->condexec_bits << 8);
- if ((env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR)
+ if (arm_feature(env, ARM_FEATURE_M)) {
+ privmode = !((env->v7m.exception == 0) && (env->v7m.control & 1));
+ } else {
+ privmode = (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR;
+ }
+ if (privmode) {
*flags |= (1 << 6);
+ }
if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30))
*flags |= (1 << 7);
}
--
1.6.3.3
next prev parent reply other threads:[~2011-01-07 15:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-07 15:06 [Qemu-devel] [PATCH 0/7] target-arm: Translate based on TB flags, not CPUState Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 1/7] target-arm: Don't generate code specific to current CPU mode for SRS Peter Maydell
2011-01-07 16:01 ` Aurelien Jarno
2011-01-07 16:25 ` Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 2/7] target-arm: Translate with VFP-enabled from TB flags, not CPUState Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 3/7] target-arm: Translate with VFP len/stride " Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 4/7] target-arm: Translate with Thumb state " Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 5/7] target-arm: Translate with condexec bits " Peter Maydell
2011-01-07 15:06 ` Peter Maydell [this message]
2011-01-07 15:06 ` [Qemu-devel] [PATCH 7/7] target-arm: Translate with user-state " Peter Maydell
2011-01-07 16:01 ` [Qemu-devel] [PATCH 0/7] target-arm: Translate based on " Aurelien Jarno
2011-01-07 16:12 ` Peter Maydell
2011-01-07 16:25 ` David Turner
2011-01-07 16:18 ` Peter Maydell
2011-01-07 17:50 ` Peter Maydell
2011-01-08 15:00 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1294412794-25573-7-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).