aboutsummaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-03-15 12:26:13 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-15 14:36:25 -0300
commit1009d2edea4acd5b683ab1572ad7f4d4583e1860 (patch)
tree7360a9fb40c4c9fa49a9c811b50c54c74673fced /cpu-exec.c
parent1ab3c6c07382c4249854f811cd6182a0a88e25fb (diff)
downloadqemu-1009d2edea4acd5b683ab1572ad7f4d4583e1860.zip
qemu-1009d2edea4acd5b683ab1572ad7f4d4583e1860.tar.gz
qemu-1009d2edea4acd5b683ab1572ad7f4d4583e1860.tar.bz2
x86: Unbreak TCG support for hardware breakpoints
Commit 83f338f73e broke x86 hardware breakpoint emulation by moving the debug exception handling out of cpu_exec. Fix this by moving all TCG related bits back, only leaving the generic guest debugging parts in cpus.c. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: TeLeMan <geleman@gmail.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 34eaedc..5cc9379 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -196,6 +196,30 @@ static inline TranslationBlock *tb_find_fast(void)
return tb;
}
+static CPUDebugExcpHandler *debug_excp_handler;
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
+{
+ CPUDebugExcpHandler *old_handler = debug_excp_handler;
+
+ debug_excp_handler = handler;
+ return old_handler;
+}
+
+static void cpu_handle_debug_exception(CPUState *env)
+{
+ CPUWatchpoint *wp;
+
+ if (!env->watchpoint_hit) {
+ QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
+ wp->flags &= ~BP_WATCHPOINT_HIT;
+ }
+ }
+ if (debug_excp_handler) {
+ debug_excp_handler(env);
+ }
+}
+
/* main execution loop */
volatile sig_atomic_t exit_request;
@@ -269,6 +293,9 @@ int cpu_exec(CPUState *env1)
if (env->exception_index >= EXCP_INTERRUPT) {
/* exit request from the cpu execution loop */
ret = env->exception_index;
+ if (ret == EXCP_DEBUG) {
+ cpu_handle_debug_exception(env);
+ }
break;
} else {
#if defined(CONFIG_USER_ONLY)