[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl->phase

From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl->phase
Date: Wed, 20 May 2015 09:54:10 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 19.05.2015 um 22:57 hat Peter Maydell geschrieben:
> On 19 May 2015 at 21:52, John Snow <address@hidden> wrote:
> > Hmm, I think this is not purely derived state because the flags are not
> > necessarily sufficient for regenerating that state.
> Yeah, if there's genuinely an underlying state machine that's
> not completely visible in registers you need to actually model it.
> You should probably then model the register bits by calculating
> them from the state rather than by changing them as you go along
> in parallel with moving the state machine around.

I think the combination of registers is actually enough to reconstruct
what state we're in, so it is derived (otherwise I would have fixed a
bug that I'm not aware of). Adding logic to derive it in a post-load
handler should be good enough.

The reason why I want to have it explicit anyway is that having the
information spread across multiple registers is non-obvious and

Before this eries, most places only check some bits instead of the full
combination. And they are correct in the sense that some states are
never expected to happen in that specific place - but if it happens
anyway (i.e. there is a bug) without the patches something undefined
happens, whereas with the patches we catch it.

And then there's the readability of the code, too, of course.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]