mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
migration: extend VMStateInfo
Current migration code cannot handle some data structures such as QTAILQ in qemu/queue.h. Here we extend the signatures of put/get in VMStateInfo so that customized handling is supported. put now will return int type. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com> Message-Id: <1484852453-12728-2-git-send-email-duanj@linux.vnet.ibm.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
d7fc72ceb5
commit
2c21ee769e
22 changed files with 262 additions and 105 deletions
|
@ -136,10 +136,12 @@ static const VMStateDescription vmstate_mtrr_var = {
|
|||
#define VMSTATE_MTRR_VARS(_field, _state, _n, _v) \
|
||||
VMSTATE_STRUCT_ARRAY(_field, _state, _n, _v, vmstate_mtrr_var, MTRRVar)
|
||||
|
||||
static void put_fpreg_error(QEMUFile *f, void *opaque, size_t size)
|
||||
static int put_fpreg_error(QEMUFile *f, void *opaque, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
fprintf(stderr, "call put_fpreg() with invalid arguments\n");
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX: add that in a FPU generic layer */
|
||||
|
@ -164,7 +166,8 @@ static void fp64_to_fp80(union x86_longdouble *p, uint64_t temp)
|
|||
p->exp = e;
|
||||
}
|
||||
|
||||
static int get_fpreg(QEMUFile *f, void *opaque, size_t size)
|
||||
static int get_fpreg(QEMUFile *f, void *opaque, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
FPReg *fp_reg = opaque;
|
||||
uint64_t mant;
|
||||
|
@ -176,7 +179,8 @@ static int get_fpreg(QEMUFile *f, void *opaque, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void put_fpreg(QEMUFile *f, void *opaque, size_t size)
|
||||
static int put_fpreg(QEMUFile *f, void *opaque, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
FPReg *fp_reg = opaque;
|
||||
uint64_t mant;
|
||||
|
@ -186,6 +190,8 @@ static void put_fpreg(QEMUFile *f, void *opaque, size_t size)
|
|||
cpu_get_fp80(&mant, &exp, fp_reg->d);
|
||||
qemu_put_be64s(f, &mant);
|
||||
qemu_put_be16s(f, &exp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateInfo vmstate_fpreg = {
|
||||
|
@ -194,7 +200,8 @@ static const VMStateInfo vmstate_fpreg = {
|
|||
.put = put_fpreg,
|
||||
};
|
||||
|
||||
static int get_fpreg_1_mmx(QEMUFile *f, void *opaque, size_t size)
|
||||
static int get_fpreg_1_mmx(QEMUFile *f, void *opaque, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
union x86_longdouble *p = opaque;
|
||||
uint64_t mant;
|
||||
|
@ -211,7 +218,8 @@ static const VMStateInfo vmstate_fpreg_1_mmx = {
|
|||
.put = put_fpreg_error,
|
||||
};
|
||||
|
||||
static int get_fpreg_1_no_mmx(QEMUFile *f, void *opaque, size_t size)
|
||||
static int get_fpreg_1_no_mmx(QEMUFile *f, void *opaque, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
union x86_longdouble *p = opaque;
|
||||
uint64_t mant;
|
||||
|
@ -273,17 +281,21 @@ static bool less_than_7(void *opaque, int version_id)
|
|||
return version_id < 7;
|
||||
}
|
||||
|
||||
static int get_uint64_as_uint32(QEMUFile *f, void *pv, size_t size)
|
||||
static int get_uint64_as_uint32(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
uint64_t *v = pv;
|
||||
*v = qemu_get_be32(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size)
|
||||
static int put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
uint64_t *v = pv;
|
||||
qemu_put_be32(f, *v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateInfo vmstate_hack_uint64_as_uint32 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue