From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I4Fxx-0006LW-C9 for qemu-devel@nongnu.org; Fri, 29 Jun 2007 08:52:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I4Fxv-0006L1-Ae for qemu-devel@nongnu.org; Fri, 29 Jun 2007 08:52:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I4Fxv-0006Kx-6S for qemu-devel@nongnu.org; Fri, 29 Jun 2007 08:52:47 -0400 Received: from mail.windriver.com ([147.11.1.11] helo=mail.wrs.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I4Fxu-0007Z2-De for qemu-devel@nongnu.org; Fri, 29 Jun 2007 08:52:46 -0400 Message-ID: <468500C9.3040503@windriver.com> Date: Fri, 29 Jun 2007 07:53:29 -0500 From: Jason Wessel MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000001090904000008050701" Subject: [Qemu-devel] [PATCH] fix crash in set registers in PPC gdb-stub 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 Cc: Jocelyn Mayer This is a multi-part message in MIME format. --------------000001090904000008050701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit While using the gdb stub on the PPC target you cannot set registers if the machine has the power save bit set in the msr without crashing QEMU. The reason it crashes is because the cpu_loop_exit() function will get called when the gdb stub is setting the registers. There is certainly more than one way to fix problem. I opted to add the check for the halted state to the store msr routine which is called from the the translated code or the gdb stub. The halted state is always set when the stub is active. Signed-off-by: Jason Wessel Jason. --------------000001090904000008050701 Content-Type: text/x-patch; name="ppc_gdb_msr_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ppc_gdb_msr_fix.patch" --- target-ppc/helper.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Index: qemu/target-ppc/helper.c =================================================================== --- qemu.orig/target-ppc/helper.c +++ qemu/target-ppc/helper.c @@ -1493,10 +1493,12 @@ void do_store_msr (CPUPPCState *env, tar break; } if (enter_pm) { - /* power save: exit cpu loop */ - env->halted = 1; - env->exception_index = EXCP_HLT; - cpu_loop_exit(); + if (likely(!env->halted)) { + /* power save: exit cpu loop */ + env->halted = 1; + env->exception_index = EXCP_HLT; + cpu_loop_exit(); + } } } --------------000001090904000008050701--