* Markus Armbruster (armbru@redhat.com) wrote:
> Sizes, virtual and physical addresses should use QAPI type 'size'
> (uint64_t). memsave, pmemsave parameters @val, @size are 'int'
> (int64_t). qmp_memsave() and qmp_pmemsave() implicitly convert to
> target_ulong or hwaddr.
>
> Change the parameters to 'size'.
>
> Both commands now accept size and address values between 2^63 and
> 2^64-1. They accept negative values as before, because that's how the
> QObject input visitor works for backward compatibility.
>
> The HMP commands' size parameters remain uint32_t, as HMP args_type
> strings can't do uint64_t byte counts: 'l' is signed, and 'o'
> multiplies by 2^20. Their address parameters remain int64_t for the
> same reason.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> cpus.c | 6 +++---
> qapi-schema.json | 5 +++--
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index 9bed61e..8c5ee05 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1947,14 +1947,14 @@ CpuInfoList *qmp_query_cpus(Error **errp)
> return head;
> }
>
> -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;
> 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;
a little bit further down is a:
error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
" specified", orig_addr, orig_size);
that PRId64 should be a PRIu64 now
However, other than that;
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> @@ -1994,7 +1994,7 @@ 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;
> diff --git a/qapi-schema.json b/qapi-schema.json
> index f4a71df..80458fa 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2460,7 +2460,8 @@
> #
> ##
> { 'command': 'memsave',
> - 'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': 'int'} }
> + 'data': {'val': 'size', 'size': 'size', 'filename': 'str',
> + '*cpu-index': 'int'} }
>
> ##
> # @pmemsave:
> @@ -2489,7 +2490,7 @@
> #
> ##
> { 'command': 'pmemsave',
> - 'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
> + 'data': {'val': 'size', 'size': 'size', 'filename': 'str'} }
>
> ##
> # @cont:
> --
> 2.7.5
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK