diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-08-29 16:36:58 +0300 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-08-29 16:36:58 +0300 |
commit | c21011a963047873135d2a47535bfbbac19769a7 (patch) | |
tree | 804e8b822eb675b3c9f5f4ac0ceac203a807e7dd /hw/eccmemctl.c | |
parent | db3c9e08e0d6eaf83f9d7a2c87dc45af3ac8f4dd (diff) | |
download | qemu-c21011a963047873135d2a47535bfbbac19769a7.zip qemu-c21011a963047873135d2a47535bfbbac19769a7.tar.gz qemu-c21011a963047873135d2a47535bfbbac19769a7.tar.bz2 |
Sparc32: port ECC memory controller to VMState design
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/eccmemctl.c')
-rw-r--r-- | hw/eccmemctl.c | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/hw/eccmemctl.c b/hw/eccmemctl.c index 0d85084..12c386b 100644 --- a/hw/eccmemctl.c +++ b/hw/eccmemctl.c @@ -263,38 +263,18 @@ static CPUWriteMemoryFunc * const ecc_diag_mem_write[3] = { NULL, }; -static int ecc_load(QEMUFile *f, void *opaque, int version_id) -{ - ECCState *s = opaque; - int i; - - if (version_id != 3) - return -EINVAL; - - for (i = 0; i < ECC_NREGS; i++) - qemu_get_be32s(f, &s->regs[i]); - - for (i = 0; i < ECC_DIAG_SIZE; i++) - qemu_get_8s(f, &s->diag[i]); - - qemu_get_be32s(f, &s->version); - - return 0; -} - -static void ecc_save(QEMUFile *f, void *opaque) -{ - ECCState *s = opaque; - int i; - - for (i = 0; i < ECC_NREGS; i++) - qemu_put_be32s(f, &s->regs[i]); - - for (i = 0; i < ECC_DIAG_SIZE; i++) - qemu_put_8s(f, &s->diag[i]); - - qemu_put_be32s(f, &s->version); -} +static const VMStateDescription vmstate_ecc = { + .name ="ECC", + .version_id = 3, + .minimum_version_id = 3, + .minimum_version_id_old = 3, + .fields = (VMStateField []) { + VMSTATE_UINT32_ARRAY(regs, ECCState, ECC_NREGS), + VMSTATE_BUFFER(diag, ECCState), + VMSTATE_UINT32(version, ECCState), + VMSTATE_END_OF_LIST() + } +}; static void ecc_reset(void *opaque) { @@ -330,7 +310,7 @@ static int ecc_init1(SysBusDevice *dev) ecc_diag_mem_write, s); sysbus_init_mmio(dev, ECC_DIAG_SIZE, ecc_io_memory); } - register_savevm("ECC", -1, 3, ecc_save, ecc_load, s); + vmstate_register(-1, &vmstate_ecc, s); qemu_register_reset(ecc_reset, s); ecc_reset(s); return 0; |