This patch adds support to gdbstub and the monitor to sync CPU state before and after the user views/changes it.
Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/qemu/gdbstub.c b/qemu/gdbstub.c index c33a66e..a3b82af 100644 --- a/qemu/gdbstub.c +++ b/qemu/gdbstub.c @@ -30,6 +30,7 @@ #include "qemu.h" #else #include "vl.h" +#include "qemu-kvm.h" #endif #include "qemu_socket.h" @@ -871,6 +872,9 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) addr = strtoull(p, (char **)&p, 16); #if defined(TARGET_I386) env->eip = addr; +#ifdef USE_KVM + kvm_load_registers(env); +#endif #elif defined (TARGET_PPC) env->nip = addr; #elif defined (TARGET_SPARC) @@ -893,6 +897,9 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) addr = strtoul(p, (char **)&p, 16); #if defined(TARGET_I386) env->eip = addr; +#ifdef USE_KVM + kvm_load_registers(env); +#endif #elif defined (TARGET_PPC) env->nip = addr; #elif defined (TARGET_SPARC) @@ -940,6 +947,9 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) } break; case 'g': +#ifdef USE_KVM + kvm_save_registers(env); +#endif reg_size = cpu_gdb_read_registers(env, mem_buf); memtohex(buf, mem_buf, reg_size); put_packet(s, buf); @@ -949,6 +959,9 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) len = strlen(p) / 2; hextomem((uint8_t *)registers, p, len); cpu_gdb_write_registers(env, mem_buf, len); +#ifdef USE_KVM + kvm_load_registers(env); +#endif put_packet(s, "OK"); break; case 'm': diff --git a/qemu/monitor.c b/qemu/monitor.c index ed8473c..de8d1ea 100644 --- a/qemu/monitor.c +++ b/qemu/monitor.c @@ -25,9 +25,8 @@ #include "disas.h" #include <dirent.h> -#if USE_KVM #include "qemu-kvm.h" -#endif + //#define DEBUG //#define DEBUG_COMPLETION @@ -258,6 +257,11 @@ CPUState *mon_get_cpu(void) if (!mon_cpu) { mon_set_cpu(0); } + +#ifdef USE_KVM + kvm_save_registers(mon_cpu); +#endif + return mon_cpu; } @@ -2253,15 +2257,6 @@ static void monitor_handle_command(const char *cmdline) goto fail; } -#ifdef USE_KVM - if(1) - { - CPUState *env=mon_get_cpu(); - if (kvm_allowed) - kvm_save_registers(env); - } -#endif - switch(nb_args) { case 0: cmd->handler(); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel