aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorJosh Junon <junon@oro.sh>2024-08-02 16:07:03 +0200
committerMarkus Armbruster <armbru@redhat.com>2024-08-05 09:34:34 +0200
commitef71d8209f5786c4e68b5ac7dbc0da7a43f0ed4e (patch)
tree03ceacf621067c4d52aad93d6069a7d3f638fb14 /system
parent01bed0ff14bb94edc3be3c701e6d31679560d388 (diff)
qmp: Fix higher half vaddrs for [p]memsave
Fixes higher-half address parsing for QMP commands `[p]memsave`. Signed-off-by: Josh Junon <junon@oro.sh> Message-ID: <20240802140704.13591-1-junon@oro.sh> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Subject tweaked, and one PRId64 updated to PRIu64] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'system')
-rw-r--r--system/cpus.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/system/cpus.c b/system/cpus.c
index 5e3a988a0a..1c818ff682 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -792,14 +792,14 @@ int vm_stop_force_state(RunState state)
}
}
-void qmp_memsave(int64_t addr, int64_t size, const char *filename,
+void qmp_memsave(uint64_t addr, uint64_t size, const char *filename,
bool has_cpu, int64_t cpu_index, Error **errp)
{
FILE *f;
- uint32_t l;
+ uint64_t l;
CPUState *cpu;
uint8_t buf[1024];
- int64_t orig_addr = addr, orig_size = size;
+ uint64_t orig_addr = addr, orig_size = size;
if (!has_cpu) {
cpu_index = 0;
@@ -823,7 +823,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
if (l > size)
l = size;
if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
- error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
+ error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRIu64
" specified", orig_addr, orig_size);
goto exit;
}
@@ -840,11 +840,11 @@ exit:
fclose(f);
}
-void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
+void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename,
Error **errp)
{
FILE *f;
- uint32_t l;
+ uint64_t l;
uint8_t buf[1024];
f = fopen(filename, "wb");