提交 6aa07a0d 编写于 作者: E Eduardo Habkost 提交者: Avi Kivity

x86: cpu_emergency_vmxoff() function

Add cpu_emergency_vmxoff() and its friends: cpu_vmx_enabled() and
__cpu_emergency_vmxoff().
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 710ff4a8
...@@ -43,4 +43,27 @@ static inline void cpu_vmxoff(void) ...@@ -43,4 +43,27 @@ static inline void cpu_vmxoff(void)
write_cr4(read_cr4() & ~X86_CR4_VMXE); write_cr4(read_cr4() & ~X86_CR4_VMXE);
} }
static inline int cpu_vmx_enabled(void)
{
return read_cr4() & X86_CR4_VMXE;
}
/** Disable VMX if it is enabled on the current CPU
*
* You shouldn't call this if cpu_has_vmx() returns 0.
*/
static inline void __cpu_emergency_vmxoff(void)
{
if (cpu_vmx_enabled())
cpu_vmxoff();
}
/** Disable VMX if it is supported and enabled on the current CPU
*/
static inline void cpu_emergency_vmxoff(void)
{
if (cpu_has_vmx())
__cpu_emergency_vmxoff();
}
#endif /* _ASM_X86_VIRTEX_H */ #endif /* _ASM_X86_VIRTEX_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册