qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction
Date: Wed, 27 Dec 2006 10:05:45 -0600	[thread overview]
Message-ID: <459299D9.50408@windriver.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

Please add this patch to CVS. 

The patch has two purposes:

1) The NIP needs to be updated for a tw instruction. 
    I found that when executing protected mode traps
    the PC was always set to the begining of the code
    generation block instead of the instruction the trap
    occurred on.

    The usual PPC breakpoint instruction is:
    7d 82 10 08 twge    r2,r2  (Trap when rA >= rB)

2) Single stepping was fixed up earlier in the year
    for using a debugger connected to the QEMU
    gdb stub.  Now it is enabled for connecting a
    runtime single stepping with the trace trap so you
    can use ptrace() or even debug KGDB.

signed-off-by: jason.wessel@windriver.com

Thanks,
Jason.

[-- Attachment #2: ppc_trace_trap_fix.patch --]
[-- Type: text/plain, Size: 935 bytes --]

Index: qemu/target-ppc/helper.c
===================================================================
--- qemu.orig/target-ppc/helper.c
+++ qemu/target-ppc/helper.c
@@ -1113,8 +1113,6 @@ void do_interrupt (CPUState *env)
         }
         goto store_next;
     case EXCP_TRACE: /* 0x0D00 */
-        /* XXX: TODO */
-        cpu_abort(env, "Trace exception is not implemented yet !\n");
         goto store_next;
     case EXCP_PERF: /* 0x0F00 */
         /* XXX: TODO */
Index: qemu/target-ppc/translate.c
===================================================================
--- qemu.orig/target-ppc/translate.c
+++ qemu/target-ppc/translate.c
@@ -1956,6 +1956,8 @@ GEN_HANDLER(tw, 0x1F, 0x04, 0xFF, 0x0000
 {
     gen_op_load_gpr_T0(rA(ctx->opcode));
     gen_op_load_gpr_T1(rB(ctx->opcode));
+    /* Update the nip since this might generate a trap exception */
+    gen_op_update_nip(ctx->nip);
     gen_op_tw(TO(ctx->opcode));
 }
 

             reply	other threads:[~2006-12-27 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-27 16:05 Jason Wessel [this message]
2006-12-27 16:24 ` [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction Ely Soto
2006-12-30  1:05   ` Rob Landley

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=459299D9.50408@windriver.com \
    --to=jason.wessel@windriver.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).