Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- include/migration/vmstate.h | 1 + migration/vmstate-types.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 1ff7bd9ac4..3b3416c2c9 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -222,6 +222,7 @@ extern const VMStateInfo vmstate_info_int8; extern const VMStateInfo vmstate_info_int16; extern const VMStateInfo vmstate_info_int32; extern const VMStateInfo vmstate_info_int64; +extern const VMStateInfo vmstate_info_int128; extern const VMStateInfo vmstate_info_uint8_equal; extern const VMStateInfo vmstate_info_uint16_equal; diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index 741a588b7e..1476c278e1 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -18,6 +18,7 @@ #include "migration/client-options.h" #include "qemu/error-report.h" #include "qemu/queue.h" +#include "qemu/int128.h" #include "trace.h" /* bool */ @@ -193,6 +194,35 @@ const VMStateInfo vmstate_info_int64 = { .put = put_int64, }; +/* 128 bit int */ + +static int get_int128(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) +{ + Int128 *v = pv; + uint64_t hi, lo; + + qemu_get_be64s(f, &hi); + qemu_get_be64s(f, &lo); + *v = int128_make128(lo, hi); + return 0; +} + +static int put_int128(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, JSONWriter *vmdesc) +{ + Int128 *v = pv; + qemu_put_be64(f, int128_gethi(*v)); + qemu_put_be64(f, int128_getlo(*v)); + return 0; +} + +const VMStateInfo vmstate_info_int128 = { + .name = "int128", + .get = get_int128, + .put = put_int128, +}; + /* 8 bit unsigned int */ static int get_uint8(QEMUFile *f, void *pv, size_t size, -- 2.43.0