From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/7] target-arm: Translate with condexec bits from TB flags, not CPUState
Date: Fri, 7 Jan 2011 15:06:32 +0000 [thread overview]
Message-ID: <1294412794-25573-6-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1294412794-25573-1-git-send-email-peter.maydell@linaro.org>
When translating, the condexec bits for the TB are in the TB flags;
the CPUState condexec bits may be different.
This patch fixes https://bugs.launchpad.net/bugs/604872 where we might
segfault if we took an exception in the middle of a TB with an IT
block, because when we came to retranslate in cpu_restore_state()
the CPUState condexec bits would have advanced compared to the start
of the TB and we would generate different (wrong) code.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/translate.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 723961a..7d042ee 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9075,8 +9075,8 @@ static inline void gen_intermediate_code_internal(CPUState *env,
dc->singlestep_enabled = env->singlestep_enabled;
dc->condjmp = 0;
dc->thumb = tb->flags & 1;
- dc->condexec_mask = (env->condexec_bits & 0xf) << 1;
- dc->condexec_cond = env->condexec_bits >> 4;
+ dc->condexec_mask = (tb->flags & 0xf00) >> 7;
+ dc->condexec_cond = (tb->flags & 0xf000) >> 12;
#if !defined(CONFIG_USER_ONLY)
if (IS_M(env)) {
dc->user = ((env->v7m.exception == 0) && (env->v7m.control & 1));
@@ -9105,7 +9105,7 @@ static inline void gen_intermediate_code_internal(CPUState *env,
gen_icount_start();
/* Reset the conditional execution bits immediately. This avoids
complications trying to do it at the end of the block. */
- if (env->condexec_bits)
+ if (dc->condexec_mask || dc->condexec_cond)
{
TCGv tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
--
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 ` Peter Maydell [this message]
2011-01-07 15:06 ` [Qemu-devel] [PATCH 6/7] target-arm: Set privileged bit in TB flags correctly for M profile Peter Maydell
2011-01-07 15:06 ` [Qemu-devel] [PATCH 7/7] target-arm: Translate with user-state from TB flags, not CPUState 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-6-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).