On Sat, May 11, 2024 at 09:24:12AM +0800, Li, Xin3 wrote:
+/*
- It's enough to check just CR4.FRED (X86_CR4_FRED) to tell if
- a vCPU is running with FRED enabled, because:
- CR4.FRED can be set to 1 only _after_ IA32_EFER.LMA = 1.
- To leave IA-32e mode, CR4.FRED must be cleared first.
- More details at FRED Spec 6.0 Section 4.2 Enabling in CR4.
- */
I think we can give more context here, e.g.,
Although FRED architecture applies to 64-bit mode only, there is no need to check if the CPU is in 64-bit mode (i.e., IA32_EFER.LMA and CS.L) to tell if FRED is enabled because CR4.FRED=1 implies the CPU is in 64-bit mode.
What is "more context" here?
e.g., why IA32_EFER.LMA and CPU mode are related to FRED here?
"it's enough to " implies something else is not necessary. what is it?
I don't think the original comment make them super clear.
Specifically,