[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/29] vmstatification: i386 FPReg
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 28/29] vmstatification: i386 FPReg |
Date: |
Thu, 11 May 2017 16:18:42 -0300 |
From: "Dr. David Alan Gilbert" <address@hidden>
Convert the fpreg save/restore to use VMSTATE_ macros rather than
.get/.put.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target/i386/machine.c | 52 +++++++++++++++++++++++++++++----------------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/target/i386/machine.c b/target/i386/machine.c
index bf9567cbd4..0b4756b35f 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -136,38 +136,46 @@ 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 int get_fpreg(QEMUFile *f, void *opaque, size_t size,
- VMStateField *field)
+typedef struct x86_FPReg_tmp {
+ FPReg *parent;
+ uint64_t tmp_mant;
+ uint16_t tmp_exp;
+} x86_FPReg_tmp;
+
+static void fpreg_pre_save(void *opaque)
{
- FPReg *fp_reg = opaque;
- uint64_t mant;
- uint16_t exp;
+ x86_FPReg_tmp *tmp = opaque;
- qemu_get_be64s(f, &mant);
- qemu_get_be16s(f, &exp);
- fp_reg->d = cpu_set_fp80(mant, exp);
- return 0;
+ /* we save the real CPU data (in case of MMX usage only 'mant'
+ contains the MMX register */
+ cpu_get_fp80(&tmp->tmp_mant, &tmp->tmp_exp, tmp->parent->d);
}
-static int put_fpreg(QEMUFile *f, void *opaque, size_t size,
- VMStateField *field, QJSON *vmdesc)
+static int fpreg_post_load(void *opaque, int version)
{
- FPReg *fp_reg = opaque;
- uint64_t mant;
- uint16_t exp;
- /* we save the real CPU data (in case of MMX usage only 'mant'
- contains the MMX register */
- cpu_get_fp80(&mant, &exp, fp_reg->d);
- qemu_put_be64s(f, &mant);
- qemu_put_be16s(f, &exp);
+ x86_FPReg_tmp *tmp = opaque;
+ tmp->parent->d = cpu_set_fp80(tmp->tmp_mant, tmp->tmp_exp);
return 0;
}
-static const VMStateInfo vmstate_fpreg = {
+static const VMStateDescription vmstate_fpreg_tmp = {
+ .name = "fpreg_tmp",
+ .post_load = fpreg_post_load,
+ .pre_save = fpreg_pre_save,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT64(tmp_mant, x86_FPReg_tmp),
+ VMSTATE_UINT16(tmp_exp, x86_FPReg_tmp),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static const VMStateDescription vmstate_fpreg = {
.name = "fpreg",
- .get = get_fpreg,
- .put = put_fpreg,
+ .fields = (VMStateField[]) {
+ VMSTATE_WITH_TMP(FPReg, x86_FPReg_tmp, vmstate_fpreg_tmp),
+ VMSTATE_END_OF_LIST()
+ }
};
static bool version_is_5(void *opaque, int version_id)
--
2.11.0.259.g40922b1
- [Qemu-devel] [PULL 18/29] virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu(), (continued)
- [Qemu-devel] [PULL 18/29] virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu(), Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 19/29] QMP: include CpuInstanceProperties into query_cpus output output, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 20/29] tests: numa: add case for QMP command query-cpus, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 21/29] numa: remove no longer need numa_post_machine_init(), Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 22/29] machine: call machine init from wrapper, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 23/29] numa: use possible_cpus for not mapped CPUs check, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 24/29] numa: remove node_cpu bitmaps as they are no longer used, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 25/29] numa: add '-numa cpu, ...' option for property based node mapping, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 26/29] tests: check -numa node, cpu=props_list usecase, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 27/29] migration/i386: Remove old non-softfloat 64bit FP support, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 28/29] vmstatification: i386 FPReg,
Eduardo Habkost <=
- [Qemu-devel] [PULL 29/29] migration/i386: Remove support for pre-0.12 formats, Eduardo Habkost, 2017/05/11
- Re: [Qemu-devel] [PULL 00/29] x86 and machine queue, 2017-05-11, Stefan Hajnoczi, 2017/05/15