* [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction
@ 2006-12-27 16:05 Jason Wessel
2006-12-27 16:24 ` Ely Soto
0 siblings, 1 reply; 3+ messages in thread
From: Jason Wessel @ 2006-12-27 16:05 UTC (permalink / raw)
To: qemu-devel
[-- 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));
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction
2006-12-27 16:05 [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction Jason Wessel
@ 2006-12-27 16:24 ` Ely Soto
2006-12-30 1:05 ` Rob Landley
0 siblings, 1 reply; 3+ messages in thread
From: Ely Soto @ 2006-12-27 16:24 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 3218 bytes --]
Excellent, I had encountered that bug earlier on when trying to debug
using workbench.
Are you guys developing a BSP for qemu?
I have a partially working one.
Ely Soto
Jason Wessel <jason.wessel@windriver.com>
Sent by: qemu-devel-bounces+soto.ely=orbital.com@nongnu.org
12/27/2006 11:05 AM
Please respond to
qemu-devel@nongnu.org
To
qemu-devel@nongnu.org
cc
Subject
[Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction
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.
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));
}
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel
-----------------------------------------
Notice: This e-mail is intended solely for use of the individual
or entity to which it is addressed and may contain information that
is proprietary, privileged and exempt from disclosure under
applicable law. If the reader is not the intended recipient or
agent responsible for delivering the message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly
prohibited. This communication may also contain data subject to
U.S. export laws. If so, that data subject to the International
Traffic in Arms Regulation cannot be disseminated, distributed or
copied to foreign nationals, residing in the U.S. or abroad, absent
the express prior approval of the U.S. Department of State. If
you have received this communication in error, please notify the
sender by reply e-mail and destroy the e-mail message and any
physical copies made of the communication. Thank you.
[-- Attachment #2: Type: text/html, Size: 4772 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction
2006-12-27 16:24 ` Ely Soto
@ 2006-12-30 1:05 ` Rob Landley
0 siblings, 0 replies; 3+ messages in thread
From: Rob Landley @ 2006-12-30 1:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Ely Soto
On Wednesday 27 December 2006 11:24 am, Ely Soto wrote:
> Excellent, I had encountered that bug earlier on when trying to debug
> using workbench.
>
> Are you guys developing a BSP for qemu?
> I have a partially working one.
I'm poking at something like that.
http://landley.net/code/firmware
http://landley.net/hg/firmware
Of course I'm using a gcc 4.x toolchain, so I'm applying the gentoo patches to
qemu 0.8.2 to build under that, and last I checked they weren't enough to get
cvs to build under gcc 4.x, but I haven't poked at it recently...
Rob
--
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-30 1:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-27 16:05 [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction Jason Wessel
2006-12-27 16:24 ` Ely Soto
2006-12-30 1:05 ` Rob Landley
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).