* [PATCH] Make sure to sync registers in monitor/gdbstub
@ 2007-06-29 15:21 Anthony Liguori
[not found] ` <11831304733956-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2007-06-29 15:21 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Anthony Liguori
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 <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Make sure to sync registers in monitor/gdbstub
[not found] ` <11831304733956-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2007-06-29 15:32 ` Avi Kivity
[not found] ` <46852608.8030105-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-06-29 15:32 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Anthony Liguori wrote:
> 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 <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> 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
>
You need some if (kvm_allowed) checks in there, no?
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Make sure to sync registers in monitor/gdbstub
[not found] ` <46852608.8030105-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-03 1:54 ` Anthony Liguori
0 siblings, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2007-07-03 1:54 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Avi Kivity wrote:
> Anthony Liguori wrote:
>
>> 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 <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>>
>> 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
>>
>>
>
> You need some if (kvm_allowed) checks in there, no?
>
Yup, new patch sent.
Regards,
Anthony Liguori
>
> -------------------------------------------------------------------------
> 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-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-03 1:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-29 15:21 [PATCH] Make sure to sync registers in monitor/gdbstub Anthony Liguori
[not found] ` <11831304733956-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-06-29 15:32 ` Avi Kivity
[not found] ` <46852608.8030105-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-03 1:54 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox