summaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-11-22 16:32:37 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2011-12-06 11:40:00 -0200
commit0cfd6a9ab4356cd2c69bb29b1d70e1fd037bc1f2 (patch)
tree70d50b3eb62d4ad3bdd4ce128d40015299754694 /hmp.c
parent588988736634ad2aa356dafac78f88d1ea68b1a4 (diff)
downloadqemu-0cfd6a9ab4356cd2c69bb29b1d70e1fd037bc1f2.tar.gz
qapi: Convert memsave
Please, note that the QMP command has a new 'cpu-index' parameter. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index dfab7ad9bb..67b3eb394b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -14,6 +14,14 @@
#include "hmp.h"
#include "qmp-commands.h"
+static void hmp_handle_error(Monitor *mon, Error **errp)
+{
+ if (error_is_set(errp)) {
+ monitor_printf(mon, "%s\n", error_get_pretty(*errp));
+ error_free(*errp);
+ }
+}
+
void hmp_info_name(Monitor *mon)
{
NameInfo *info;
@@ -531,3 +539,14 @@ void hmp_cpu(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "invalid CPU index\n");
}
}
+
+void hmp_memsave(Monitor *mon, const QDict *qdict)
+{
+ uint32_t size = qdict_get_int(qdict, "size");
+ const char *filename = qdict_get_str(qdict, "filename");
+ uint64_t addr = qdict_get_int(qdict, "val");
+ Error *errp = NULL;
+
+ qmp_memsave(addr, size, filename, true, monitor_get_cpu_index(), &errp);
+ hmp_handle_error(mon, &errp);
+}