return ret;
}
-static void do_physical_memory_save(Monitor *mon, const QDict *qdict,
+static int do_physical_memory_save(Monitor *mon, const QDict *qdict,
QObject **ret_data)
{
FILE *f;
uint32_t size = qdict_get_int(qdict, "size");
const char *filename = qdict_get_str(qdict, "filename");
target_phys_addr_t addr = qdict_get_int(qdict, "val");
+ int ret = -1;
f = fopen(filename, "wb");
if (!f) {
qemu_error_new(QERR_OPEN_FILE_FAILED, filename);
- return;
+ return -1;
}
while (size != 0) {
l = sizeof(buf);
addr += l;
size -= l;
}
+
+ ret = 0;
+
exit:
fclose(f);
+ return ret;
}
static void do_sum(Monitor *mon, const QDict *qdict)
.params = "addr size file",
.help = "save to disk physical memory dump starting at 'addr' of size 'size'",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = do_physical_memory_save,
+ .cmd_new_ret = do_physical_memory_save,
},
STEXI