qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] target-sparc: Fix -singlestep.
@ 2010-04-25 18:01 Richard Henderson
  2010-04-25 18:01 ` [Qemu-devel] [PATCH 2/2] linux-user: Fix Sparc64 syscall returns Richard Henderson
  2010-04-25 18:11 ` [Qemu-devel] Re: [PATCH 1/2] target-sparc: Fix -singlestep Blue Swirl
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Henderson @ 2010-04-25 18:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-26 17:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-25 18:01 [Qemu-devel] [PATCH 1/2] target-sparc: Fix -singlestep Richard Henderson
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

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).