From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com
Subject: [Qemu-devel] [PATCH 1/2] target-sparc: Fix -singlestep.
Date: Sun, 25 Apr 2010 11:01:24 -0700 [thread overview]
Message-ID: <1272218485-12465-1-git-send-email-rth@twiddle.net> (raw)
Single-stepping was not properly updating npc, resulting in some
instructions being executed twice. In addition, we were emitting
dead code at the end of the TB.
Fix both by teaching gen_goto_tb to avoid goto_tb for single-step
and removing the special-case code in gen_intermediate_code_internal.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
target-sparc/translate.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index b54c520..5162b87 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -81,6 +81,7 @@ typedef struct DisasContext {
int address_mask_32bit;
uint32_t cc_op; /* current CC operation */
struct TranslationBlock *tb;
+ CPUState *env;
sparc_def_t *def;
} DisasContext;
@@ -234,7 +235,8 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num,
tb = s->tb;
if ((pc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK) &&
- (npc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK)) {
+ (npc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK) &&
+ !(s->env->singlestep_enabled || singlestep)) {
/* jump to same page: we can use a direct jump */
tcg_gen_goto_tb(tb_num);
tcg_gen_movi_tl(cpu_pc, pc);
@@ -4680,6 +4682,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
memset(dc, 0, sizeof(DisasContext));
dc->tb = tb;
+ dc->env = env;
pc_start = tb->pc;
dc->pc = pc_start;
last_pc = dc->pc;
@@ -4755,8 +4758,6 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
/* if single step mode, we generate only one instruction and
generate an exception */
if (env->singlestep_enabled || singlestep) {
- tcg_gen_movi_tl(cpu_pc, dc->pc);
- tcg_gen_exit_tb(0);
break;
}
} while ((gen_opc_ptr < gen_opc_end) &&
--
1.6.6.1
next reply other threads:[~2010-04-25 18:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 18:01 Richard Henderson [this message]
2010-04-25 18:01 ` [Qemu-devel] [PATCH 2/2] linux-user: Fix Sparc64 syscall returns Richard Henderson
2010-04-25 18:08 ` [Qemu-devel] " Blue Swirl
2010-04-25 18:11 ` [Qemu-devel] Re: [PATCH 1/2] target-sparc: Fix -singlestep Blue Swirl
2010-04-26 17:17 ` [Qemu-devel] [PATCH] " Richard Henderson
2010-04-26 17:27 ` [Qemu-devel] " Blue Swirl
2010-04-26 17:27 ` [Qemu-devel] [PATCH] linux-user: Fix sparc32plus stat64 syscalls Richard Henderson
2010-04-26 17:34 ` [Qemu-devel] " Blue Swirl
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=1272218485-12465-1-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=blauwirbel@gmail.com \
--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).