arch/x86/kvm/vmx/vmcs.h
Source file repositories/reference/linux-study-clean/arch/x86/kvm/vmx/vmcs.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kvm/vmx/vmcs.h- Extension
.h- Size
- 4906 bytes
- Lines
- 197
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ktime.hlinux/list.hlinux/nospec.hasm/kvm.hasm/vmx.hcapabilities.h
Detected Declarations
struct vmcs_host_statestruct vmcs_controls_shadowstruct loaded_vmcsenum vmcs_field_widthfunction is_intr_typefunction is_intr_type_nfunction is_exception_nfunction is_debugfunction is_breakpointfunction is_double_faultfunction is_page_faultfunction is_invalid_opcodefunction is_gp_faultfunction is_alignment_checkfunction is_machine_checkfunction is_nm_faultfunction is_ve_faultfunction is_icebpfunction is_nmifunction is_external_intrfunction is_exception_with_error_codefunction vmcs_field_widthfunction vmcs_field_readonlyfunction vmcs_field_index
Annotated Snippet
struct vmcs_host_state {
unsigned long cr3; /* May not match real cr3 */
unsigned long cr4; /* May not match real cr4 */
unsigned long gs_base;
unsigned long fs_base;
unsigned long rsp;
u16 fs_sel, gs_sel, ldt_sel;
#ifdef CONFIG_X86_64
u16 ds_sel, es_sel;
#endif
};
struct vmcs_controls_shadow {
u32 vm_entry;
u32 vm_exit;
u32 pin;
u32 exec;
u32 secondary_exec;
u64 tertiary_exec;
};
/*
* Track a VMCS that may be loaded on a certain CPU. If it is (cpu!=-1), also
* remember whether it was VMLAUNCHed, and maintain a linked list of all VMCSs
* loaded on this CPU (so we can clear them if the CPU goes down).
*/
struct loaded_vmcs {
struct vmcs *vmcs;
struct vmcs *shadow_vmcs;
int cpu;
bool launched;
bool nmi_known_unmasked;
bool hv_timer_soft_disabled;
/* Support for vnmi-less CPUs */
int soft_vnmi_blocked;
ktime_t entry_time;
s64 vnmi_blocked_time;
unsigned long *msr_bitmap;
struct list_head loaded_vmcss_on_cpu_link;
struct vmcs_host_state host_state;
struct vmcs_controls_shadow controls_shadow;
};
static __always_inline bool is_intr_type(u32 intr_info, u32 type)
{
const u32 mask = INTR_INFO_VALID_MASK | INTR_INFO_INTR_TYPE_MASK;
return (intr_info & mask) == (INTR_INFO_VALID_MASK | type);
}
static inline bool is_intr_type_n(u32 intr_info, u32 type, u8 vector)
{
const u32 mask = INTR_INFO_VALID_MASK | INTR_INFO_INTR_TYPE_MASK |
INTR_INFO_VECTOR_MASK;
return (intr_info & mask) == (INTR_INFO_VALID_MASK | type | vector);
}
static inline bool is_exception_n(u32 intr_info, u8 vector)
{
return is_intr_type_n(intr_info, INTR_TYPE_HARD_EXCEPTION, vector);
}
static inline bool is_debug(u32 intr_info)
{
return is_exception_n(intr_info, DB_VECTOR);
}
static inline bool is_breakpoint(u32 intr_info)
{
return is_exception_n(intr_info, BP_VECTOR);
}
static inline bool is_double_fault(u32 intr_info)
{
return is_exception_n(intr_info, DF_VECTOR);
}
static inline bool is_page_fault(u32 intr_info)
{
return is_exception_n(intr_info, PF_VECTOR);
}
static inline bool is_invalid_opcode(u32 intr_info)
{
return is_exception_n(intr_info, UD_VECTOR);
}
static inline bool is_gp_fault(u32 intr_info)
Annotation
- Immediate include surface: `linux/ktime.h`, `linux/list.h`, `linux/nospec.h`, `asm/kvm.h`, `asm/vmx.h`, `capabilities.h`.
- Detected declarations: `struct vmcs_host_state`, `struct vmcs_controls_shadow`, `struct loaded_vmcs`, `enum vmcs_field_width`, `function is_intr_type`, `function is_intr_type_n`, `function is_exception_n`, `function is_debug`, `function is_breakpoint`, `function is_double_fault`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.