arch/x86/kvm/smm.h

Source file repositories/reference/linux-study-clean/arch/x86/kvm/smm.h

File Facts

System
Linux kernel
Corpus path
arch/x86/kvm/smm.h
Extension
.h
Size
3811 bytes
Lines
172
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct kvm_smm_seg_state_32 {
	u32 flags;
	u32 limit;
	u32 base;
} __packed;

struct kvm_smram_state_32 {
	u32 reserved1[62];
	u32 smbase;
	u32 smm_revision;
	u16 io_inst_restart;
	u16 auto_hlt_restart;
	u32 io_restart_rdi;
	u32 io_restart_rcx;
	u32 io_restart_rsi;
	u32 io_restart_rip;
	u32 cr4;

	/* A20M#, CPL, shutdown and other reserved/undocumented fields */
	u16 reserved2;
	u8 int_shadow; /* KVM extension */
	u8 reserved3[17];

	struct kvm_smm_seg_state_32 ds;
	struct kvm_smm_seg_state_32 fs;
	struct kvm_smm_seg_state_32 gs;
	struct kvm_smm_seg_state_32 idtr; /* IDTR has only base and limit */
	struct kvm_smm_seg_state_32 tr;
	u32 reserved;
	struct kvm_smm_seg_state_32 gdtr; /* GDTR has only base and limit */
	struct kvm_smm_seg_state_32 ldtr;
	struct kvm_smm_seg_state_32 es;
	struct kvm_smm_seg_state_32 cs;
	struct kvm_smm_seg_state_32 ss;

	u32 es_sel;
	u32 cs_sel;
	u32 ss_sel;
	u32 ds_sel;
	u32 fs_sel;
	u32 gs_sel;
	u32 ldtr_sel;
	u32 tr_sel;

	u32 dr7;
	u32 dr6;
	u32 gprs[8]; /* GPRS in the "natural" X86 order (EAX/ECX/EDX.../EDI) */
	u32 eip;
	u32 eflags;
	u32 cr3;
	u32 cr0;
} __packed;


/* 64 bit KVM's emulated SMM layout. Based on AMD64 layout */

struct kvm_smm_seg_state_64 {
	u16 selector;
	u16 attributes;
	u32 limit;
	u64 base;
};

struct kvm_smram_state_64 {

	struct kvm_smm_seg_state_64 es;
	struct kvm_smm_seg_state_64 cs;
	struct kvm_smm_seg_state_64 ss;
	struct kvm_smm_seg_state_64 ds;
	struct kvm_smm_seg_state_64 fs;
	struct kvm_smm_seg_state_64 gs;
	struct kvm_smm_seg_state_64 gdtr; /* GDTR has only base and limit*/
	struct kvm_smm_seg_state_64 ldtr;
	struct kvm_smm_seg_state_64 idtr; /* IDTR has only base and limit*/
	struct kvm_smm_seg_state_64 tr;

	/* I/O restart and auto halt restart are not implemented by KVM */
	u64 io_restart_rip;
	u64 io_restart_rcx;
	u64 io_restart_rsi;
	u64 io_restart_rdi;
	u32 io_restart_dword;
	u32 reserved1;
	u8 io_inst_restart;
	u8 auto_hlt_restart;
	u8 amd_nmi_mask; /* Documented in AMD BKDG as NMI mask, not used by KVM */
	u8 int_shadow;
	u32 reserved2;

	u64 efer;

Annotation

Implementation Notes