接前一篇文章:
本文内容参考:
《 QEMU /KVM》源码解析与应用 —— 李强,机械工业出版社
特此致谢!
一、CPU虚拟化介绍
上一回讲解了VMCS数据区总的前3个区域,分别是:Guest-state区域、Host-state区域、VM-execution控制区域。VMCS数据区总共有6个区域,下面对余下的区域分别做简要介绍。
3. VMCS介绍
(4)VM Exit控制区域
VM Exit控制区域用来指定 虚拟机 在发生VM Exit时的行为,如一些寄存器的保存。
完整的VM Exit control区域如下表所示:
VM-Exit Controls | Save debug controls | Host Address space size | Load IA32_PERF_GLOBAL_CTRL | ||
Acknowledge interrupt on exit | Save IA32_PAT | Load IA32_PAT | Save IA32_EFER | Load IA32_EFER | |
Save VMX preemption timer value | Clear IA32_BNDFGS | Conceal VM exits from Intel PT | |||
VM-Exit Controls for MSRs | VM-exit MSR-strore count | VM-entry MSR-load address | |||
VM-exit MSR-load count | VM-exit MSR-load address |
(5)VM Entry控制区域
VM Entry区域用来指定虚拟机在发生VM Entry时的行为,如一些寄存器的加载,还有一些虚拟机的事件注入。
完整的VM Entry control区域如下图所示:
VM-Entry Controls | Load debug controls | IA-32e mode guest | Entry to SMM | ||
Deactivate dual-monitor treatment | Load IA32_PERF_GLOBAL_CTRL | Load IA32_PAT | |||
Load IA32_EFER | Load IA32_BNDCFGS | Conceal VMX from PT | |||
VM-Exit Controls for MSRs | VM-entry MSR-load count | VM-entry MSR-load address | |||
VM-Entry for Event Injection | VM-entry interruption-ubfirnatuib fuekd | VM-entry exception error code | VM-entry instruction length |
(6)VM Exit信息区域
VM Exit信息区域包含了最近产生的VM Exit信息,典型的信息包括退出的原因以及相应的数据,如指令执行的退出会记录指令的长度等。
完整的VM Exit信息区域如下表所示:
Base VM-Exit information | Exit reason | Exit qualification | ||
Guest-linear address | Guest-physical address | |||
VM Exits Due to Vectored Events | VM-exit interruption information | VM-exit interruption error code | ||
VM Exits That Occur During Event Delivery | IDT-vectoring information | IDT-vectoring error code | ||
VM Exits Due to instruction Execution | VM-exiting instruction length | VM-exiting instruction information | ||
I/O RCX | I/O RSI | I/O RDI | I/O RIP | |
VM-instruction error field |
至此,VMCS数据区的6个区域就全部介绍完了。