Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/vmm/intel/vmx.h
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
/* Index into the 'guest_msrs[]' array */ | /* Index into the 'guest_msrs[]' array */ | ||||
enum { | enum { | ||||
IDX_MSR_LSTAR, | IDX_MSR_LSTAR, | ||||
IDX_MSR_CSTAR, | IDX_MSR_CSTAR, | ||||
IDX_MSR_STAR, | IDX_MSR_STAR, | ||||
IDX_MSR_SF_MASK, | IDX_MSR_SF_MASK, | ||||
IDX_MSR_KGSBASE, | IDX_MSR_KGSBASE, | ||||
IDX_MSR_PAT, | IDX_MSR_PAT, | ||||
IDX_MSR_TSC_AUX, | |||||
GUEST_MSR_NUM /* must be the last enumeration */ | GUEST_MSR_NUM /* must be the last enumeration */ | ||||
}; | }; | ||||
/* virtual machine softc */ | /* virtual machine softc */ | ||||
struct vmx { | struct vmx { | ||||
struct vmcs vmcs[VM_MAXCPU]; /* one vmcs per virtual cpu */ | struct vmcs vmcs[VM_MAXCPU]; /* one vmcs per virtual cpu */ | ||||
struct apic_page apic_page[VM_MAXCPU]; /* one apic page per vcpu */ | struct apic_page apic_page[VM_MAXCPU]; /* one apic page per vcpu */ | ||||
char msr_bitmap[PAGE_SIZE]; | char msr_bitmap[PAGE_SIZE]; | ||||
Show All 19 Lines | |||||
u_long vmx_fix_cr0(u_long cr0); | u_long vmx_fix_cr0(u_long cr0); | ||||
u_long vmx_fix_cr4(u_long cr4); | u_long vmx_fix_cr4(u_long cr4); | ||||
int vmx_set_tsc_offset(struct vmx *vmx, int vcpu, uint64_t offset); | int vmx_set_tsc_offset(struct vmx *vmx, int vcpu, uint64_t offset); | ||||
extern char vmx_exit_guest[]; | extern char vmx_exit_guest[]; | ||||
extern char vmx_exit_guest_flush_rsb[]; | extern char vmx_exit_guest_flush_rsb[]; | ||||
static inline bool | |||||
vmx_have_msr_tsc_aux(struct vmx *vmx) | |||||
{ | |||||
int rdpid_rdtscp_bits = ((1 << VM_CAP_RDPID) | (1 << VM_CAP_RDTSCP)); | |||||
/* | |||||
* Since the values of these bits are uniform across all vCPUs | |||||
* (see discussion in vmx_init() and initialization of these bits | |||||
* in vmx_vminit()), just always use vCPU-zero's capability set and | |||||
* remove the need to require a vcpuid argument. | |||||
*/ | |||||
return ((vmx->cap[0].set & rdpid_rdtscp_bits) != 0); | |||||
} | |||||
#endif | #endif |