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);