diff --git a/docs/figs/vmcs/state.png b/docs/figs/vmcs/state.png new file mode 100644 index 0000000000000000000000000000000000000000..f496322638647a71d840d31a9d10075d2355f1d3 Binary files /dev/null and b/docs/figs/vmcs/state.png differ diff --git a/docs/vmcs.md b/docs/vmcs.md index cfa08130f9c1a52d1b68395c2e1928cf3e0d8767..7bafe4afca271eddddb91c7c35594b70fdca8254 100644 --- a/docs/vmcs.md +++ b/docs/vmcs.md @@ -30,3 +30,24 @@ struct vmcs_t { [^1]: it seems that the `gcc` extension `__attribute__((packed))` doesn't help in this case because it ruins the 8-byte alignment (according to `clangd`) + +## States + +The figure below helps to illustrate the lifecycle of a VM and its corresponding +VMCSs. + + + +### Current + +- After the execution of the `vmptrld` instruction with the address of a given +VMCS as its memory operand, that VMCS becomes both _active_ and **_current_** +on the logical processor +- At most one of the _active_ VMCSs is the **_current_** VMCS + +### Launch + +- Determines which VM-entry instruction should be used with that VMCS + - The `vmlaunch` instruction requires a VMCS whose _launch_ state is + **"clear"** + - Successful execution of the instruction changes the state to **"launched"**