On Mon, Mar 22, 2021 at 10:55:46AM -0600, Richard Henderson wrote:
> On 3/21/21 9:52 PM, David Gibson wrote:
> > > +/*
> > > + * Bits for env->hflags.
> > > + *
> > > + * Most of these bits overlap with corresponding bits in MSR,
> > > + * but some come from other sources.  Be cautious when modifying.
> > 
> > Yeah.. I'm not sure "be cautious" is enough of a warning.  The exact
> > value of some but not all of these flags must equal that for the
> > corresponding MSR bits, which is terrifyingly subtle.
> 
> Fair.  How about, for the comment here, "This is validated in 
> hreg_compute_hflags."
> 
> > > +    /* Some bits come straight across from MSR. */
> > > +    msr_mask = ((1 << MSR_LE) | (1 << MSR_PR) |
> > > +                (1 << MSR_DR) | (1 << MSR_IR) |
> > > +                (1 << MSR_FP) | (1 << MSR_SA) | (1 << MSR_AP));
> 
> Here, and in every other spot within this function where we manipulate 
> msr_mask,
> 
>     QEMU_BUILD_BUG_ON(MSR_LE != HFLAGS_LE);

Seems reasonable.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature

Reply via email to