From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GzbHw-000757-R5 for qemu-devel@nongnu.org; Wed, 27 Dec 2006 11:05:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GzbHv-00074D-MT for qemu-devel@nongnu.org; Wed, 27 Dec 2006 11:05:56 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GzbHv-000746-Jf for qemu-devel@nongnu.org; Wed, 27 Dec 2006 11:05:55 -0500 Received: from [147.11.1.11] (helo=mail.wrs.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GzbHu-00033T-RO for qemu-devel@nongnu.org; Wed, 27 Dec 2006 11:05:55 -0500 Received: from ALA-MAIL03.corp.ad.wrs.com (ala-mail03 [147.11.57.144]) by mail.wrs.com (8.13.6/8.13.6) with ESMTP id kBRG5kbT025785 for ; Wed, 27 Dec 2006 08:05:46 -0800 (PST) Message-ID: <459299D9.50408@windriver.com> Date: Wed, 27 Dec 2006 10:05:45 -0600 From: Jason Wessel MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070904010600030904010701" Subject: [Qemu-devel] [PATCH] PPC32 Trace Exception and Trap instruction Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------070904010600030904010701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------070904010600030904010701 Content-Type: text/plain; name="ppc_trace_trap_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ppc_trace_trap_fix.patch" 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)); } --------------070904010600030904010701--