Skip to content
Snippets Groups Projects
Commit 9e08e9f5 authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

feat: explained the relevant bits to VMX of the IA32_FEATURE_CONTROL Model-Specific Register

parent c7ae8fcd
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,33 @@ static void enable_vmx(void) {
}
```
VMXON is also controlled by the IA32_FEATURE_CONTROL MSR (Model-Specific
Register). MSRs are 64-bit wide. The address of IA32_FEATURE_CONTROL MSR is
**0x3a**.
The relevant bits (in terms of VMX) of this MSR are:
- Bit 0 (Lock bit)
- System BIOS can use this bit to provide a setup option for BIOS to disable
support for VMX. **If this bit is set, WRMSR to this MSR will cause a general-
protection exception**. To enable VMX support in a platform, BIOS must set bit
1, bit 2, or both (see below), as well as the lock bit.
- Bit 1 (VMXON in SMX operation)
- Bit 2 (VMXON outside SMX operation)
**In my case, after having activated VT-x through the BIOS, the value returned
by the IA32_FEATURE_CONTROL MSR is always equal to 5 (e.g. the lock bit and
VMXON outside SMX operation are always set).**
**If I decide to deactivate VT-x, the MSR will return the value of 1 (e.g. lock
bit).**
Due to the fact that the **lock bit** is always **set**, it means that I'm not
able to write to this MSR using __wrmsr. What's interesting about this is that
the tutorial tries to modify this MSR but if we assume that the **lock bit is set**
that branch **will be a no-op**.
## References
[^1]: [The Linux Kernel Module Programming Guide](https://sysprog21.github.io/lkmpg/)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment