Il 17/07/2014 13:02, Pavel Dovgalyuk ha scritto: > This patch adds outport to VMState to allow correct saving and restoring > the state of PC keyboard controller. > > Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> > --- > hw/input/pckbd.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c > index ca1cffc..19f6658 100644 > --- a/hw/input/pckbd.c > +++ b/hw/input/pckbd.c > @@ -371,13 +371,14 @@ static void kbd_reset(void *opaque) > > static const VMStateDescription vmstate_kbd = { > .name = "pckbd", > - .version_id = 3, > + .version_id = 4, > .minimum_version_id = 3, > .fields = (VMStateField[]) { > VMSTATE_UINT8(write_cmd, KBDState), > VMSTATE_UINT8(status, KBDState), > VMSTATE_UINT8(mode, KBDState), > VMSTATE_UINT8(pending, KBDState), > + VMSTATE_UINT8_V(outport, KBDState, 4), > VMSTATE_END_OF_LIST() > } > }; > > >
Again it would be nice to use a subsection. You can use as the "default" value KBD_OUT_RESET | KBD_OUT_A20 | (kbd->status & KBD_STAT_OBF ? KBD_OUT_OBF : 0) | (kbd->status & KBD_STAT_MOUSE_OBF ? KBD_OUT_MOUSE_OBF : 0) If the value of outport matches this, you need not write it. It's not trivial, but you could do it like this: - needed: return false if outport doesn't have the value above - subsection post_load: set kbd->outport_present = 1 - device post_load: reconstruct outport if kbd->outport_present == 0 Paolo