tools/testing/selftests/kvm/include/x86/vmx.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/include/x86/vmx.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/include/x86/vmx.h- Extension
.h- Size
- 15408 bytes
- Lines
- 565
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/vmx.hstdint.hprocessor.hapic.hevmcs.h
Detected Declarations
struct vmx_msr_entrystruct vmx_pagesenum vmcs_fieldfunction vmxonfunction vmxofffunction vmclearfunction vmptrldfunction vmptrstfunction vmptrstzfunction statefunction statefunction vmcallfunction vmreadfunction vmreadzfunction vmwritefunction vmcs_revision
Annotated Snippet
struct vmx_msr_entry {
u32 index;
u32 reserved;
u64 value;
} __attribute__ ((aligned(16)));
#include "evmcs.h"
static inline int vmxon(u64 phys)
{
u8 ret;
__asm__ __volatile__ ("vmxon %[pa]; setna %[ret]"
: [ret]"=rm"(ret)
: [pa]"m"(phys)
: "cc", "memory");
return ret;
}
static inline void vmxoff(void)
{
__asm__ __volatile__("vmxoff");
}
static inline int vmclear(u64 vmcs_pa)
{
u8 ret;
__asm__ __volatile__ ("vmclear %[pa]; setna %[ret]"
: [ret]"=rm"(ret)
: [pa]"m"(vmcs_pa)
: "cc", "memory");
return ret;
}
static inline int vmptrld(u64 vmcs_pa)
{
u8 ret;
if (enable_evmcs)
return -1;
__asm__ __volatile__ ("vmptrld %[pa]; setna %[ret]"
: [ret]"=rm"(ret)
: [pa]"m"(vmcs_pa)
: "cc", "memory");
return ret;
}
static inline int vmptrst(u64 *value)
{
u64 tmp;
u8 ret;
if (enable_evmcs)
return evmcs_vmptrst(value);
__asm__ __volatile__("vmptrst %[value]; setna %[ret]"
: [value]"=m"(tmp), [ret]"=rm"(ret)
: : "cc", "memory");
*value = tmp;
return ret;
}
/*
* A wrapper around vmptrst that ignores errors and returns zero if the
* vmptrst instruction fails.
*/
static inline u64 vmptrstz(void)
{
u64 value = 0;
vmptrst(&value);
return value;
}
/*
* No guest state (e.g. GPRs) is established by this vmlaunch.
*/
static inline int vmlaunch(void)
{
int ret;
if (enable_evmcs)
return evmcs_vmlaunch();
__asm__ __volatile__("push %%rbp;"
Annotation
- Immediate include surface: `asm/vmx.h`, `stdint.h`, `processor.h`, `apic.h`, `evmcs.h`.
- Detected declarations: `struct vmx_msr_entry`, `struct vmx_pages`, `enum vmcs_field`, `function vmxon`, `function vmxoff`, `function vmclear`, `function vmptrld`, `function vmptrst`, `function vmptrstz`, `function state`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.