qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fix crash in set registers in PPC gdb-stub


From: Jason Wessel
Subject: [Qemu-devel] [PATCH] fix crash in set registers in PPC gdb-stub
Date: Fri, 29 Jun 2007 07:53:29 -0500
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

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 <address@hidden>

Jason.


---
 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();
+        }
     }
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]