aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r--drivers/kvm/kvm.h109
1 files changed, 0 insertions, 109 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 1c4de50ac06a..41f6ee2134de 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -577,115 +577,6 @@ static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
577 return slot - kvm->memslots; 577 return slot - kvm->memslots;
578} 578}
579 579
580static inline struct kvm_mmu_page *page_header(hpa_t shadow_page)
581{
582 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT);
583
584 return (struct kvm_mmu_page *)page_private(page);
585}
586
587static inline u16 read_fs(void)
588{
589 u16 seg;
590 asm("mov %%fs, %0" : "=g"(seg));
591 return seg;
592}
593
594static inline u16 read_gs(void)
595{
596 u16 seg;
597 asm("mov %%gs, %0" : "=g"(seg));
598 return seg;
599}
600
601static inline u16 read_ldt(void)
602{
603 u16 ldt;
604 asm("sldt %0" : "=g"(ldt));
605 return ldt;
606}
607
608static inline void load_fs(u16 sel)
609{
610 asm("mov %0, %%fs" : : "rm"(sel));
611}
612
613static inline void load_gs(u16 sel)
614{
615 asm("mov %0, %%gs" : : "rm"(sel));
616}
617
618#ifndef load_ldt
619static inline void load_ldt(u16 sel)
620{
621 asm("lldt %0" : : "rm"(sel));
622}
623#endif
624
625static inline void get_idt(struct descriptor_table *table)
626{
627 asm("sidt %0" : "=m"(*table));
628}
629
630static inline void get_gdt(struct descriptor_table *table)
631{
632 asm("sgdt %0" : "=m"(*table));
633}
634
635static inline unsigned long read_tr_base(void)
636{
637 u16 tr;
638 asm("str %0" : "=g"(tr));
639 return segment_base(tr);
640}
641
642#ifdef CONFIG_X86_64
643static inline unsigned long read_msr(unsigned long msr)
644{
645 u64 value;
646
647 rdmsrl(msr, value);
648 return value;
649}
650#endif
651
652static inline void fx_save(struct i387_fxsave_struct *image)
653{
654 asm("fxsave (%0)":: "r" (image));
655}
656
657static inline void fx_restore(struct i387_fxsave_struct *image)
658{
659 asm("fxrstor (%0)":: "r" (image));
660}
661
662static inline void fpu_init(void)
663{
664 asm("finit");
665}
666
667static inline u32 get_rdx_init_val(void)
668{
669 return 0x600; /* P6 family */
670}
671
672#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30"
673#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2"
674#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3"
675#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30"
676#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0"
677#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0"
678#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4"
679#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4"
680#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30"
681
682#define MSR_IA32_TIME_STAMP_COUNTER 0x010
683
684#define TSS_IOPB_BASE_OFFSET 0x66
685#define TSS_BASE_SIZE 0x68
686#define TSS_IOPB_SIZE (65536 / 8)
687#define TSS_REDIRECTION_SIZE (256 / 8)
688#define RMODE_TSS_SIZE (TSS_BASE_SIZE + TSS_REDIRECTION_SIZE + TSS_IOPB_SIZE + 1)
689 580
690enum kvm_stat_kind { 581enum kvm_stat_kind {
691 KVM_STAT_VM, 582 KVM_STAT_VM,