aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-02-16 03:51:48 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 05:27:28 -0400
commit89a27f4d0e042a2fa3391a76b652aec3e16ef200 (patch)
treed2cf954c066c6f5fbd51a15a439b63d1dba53edd /arch/x86/kvm/vmx.c
parent679613442f84702c06a80f2320cb8a50089200bc (diff)
KVM: use desc_ptr struct instead of kvm private descriptor_table
x86 arch defines desc_ptr for idt/gdt pointers, no need to define another structure in kvm code. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bc933cfb4e66..68f895b00450 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -600,11 +600,11 @@ static void reload_tss(void)
600 /* 600 /*
601 * VT restores TR but not its size. Useless. 601 * VT restores TR but not its size. Useless.
602 */ 602 */
603 struct descriptor_table gdt; 603 struct desc_ptr gdt;
604 struct desc_struct *descs; 604 struct desc_struct *descs;
605 605
606 kvm_get_gdt(&gdt); 606 kvm_get_gdt(&gdt);
607 descs = (void *)gdt.base; 607 descs = (void *)gdt.address;
608 descs[GDT_ENTRY_TSS].type = 9; /* available TSS */ 608 descs[GDT_ENTRY_TSS].type = 9; /* available TSS */
609 load_TR_desc(); 609 load_TR_desc();
610} 610}
@@ -758,7 +758,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
758 } 758 }
759 759
760 if (vcpu->cpu != cpu) { 760 if (vcpu->cpu != cpu) {
761 struct descriptor_table dt; 761 struct desc_ptr dt;
762 unsigned long sysenter_esp; 762 unsigned long sysenter_esp;
763 763
764 vcpu->cpu = cpu; 764 vcpu->cpu = cpu;
@@ -768,7 +768,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
768 */ 768 */
769 vmcs_writel(HOST_TR_BASE, kvm_read_tr_base()); /* 22.2.4 */ 769 vmcs_writel(HOST_TR_BASE, kvm_read_tr_base()); /* 22.2.4 */
770 kvm_get_gdt(&dt); 770 kvm_get_gdt(&dt);
771 vmcs_writel(HOST_GDTR_BASE, dt.base); /* 22.2.4 */ 771 vmcs_writel(HOST_GDTR_BASE, dt.address); /* 22.2.4 */
772 772
773 rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); 773 rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
774 vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ 774 vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
@@ -1934,28 +1934,28 @@ static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
1934 *l = (ar >> 13) & 1; 1934 *l = (ar >> 13) & 1;
1935} 1935}
1936 1936
1937static void vmx_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 1937static void vmx_get_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt)
1938{ 1938{
1939 dt->limit = vmcs_read32(GUEST_IDTR_LIMIT); 1939 dt->size = vmcs_read32(GUEST_IDTR_LIMIT);
1940 dt->base = vmcs_readl(GUEST_IDTR_BASE); 1940 dt->address = vmcs_readl(GUEST_IDTR_BASE);
1941} 1941}
1942 1942
1943static void vmx_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 1943static void vmx_set_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt)
1944{ 1944{
1945 vmcs_write32(GUEST_IDTR_LIMIT, dt->limit); 1945 vmcs_write32(GUEST_IDTR_LIMIT, dt->size);
1946 vmcs_writel(GUEST_IDTR_BASE, dt->base); 1946 vmcs_writel(GUEST_IDTR_BASE, dt->address);
1947} 1947}
1948 1948
1949static void vmx_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 1949static void vmx_get_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt)
1950{ 1950{
1951 dt->limit = vmcs_read32(GUEST_GDTR_LIMIT); 1951 dt->size = vmcs_read32(GUEST_GDTR_LIMIT);
1952 dt->base = vmcs_readl(GUEST_GDTR_BASE); 1952 dt->address = vmcs_readl(GUEST_GDTR_BASE);
1953} 1953}
1954 1954
1955static void vmx_set_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 1955static void vmx_set_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt)
1956{ 1956{
1957 vmcs_write32(GUEST_GDTR_LIMIT, dt->limit); 1957 vmcs_write32(GUEST_GDTR_LIMIT, dt->size);
1958 vmcs_writel(GUEST_GDTR_BASE, dt->base); 1958 vmcs_writel(GUEST_GDTR_BASE, dt->address);
1959} 1959}
1960 1960
1961static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg) 1961static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg)
@@ -2334,7 +2334,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2334 u32 junk; 2334 u32 junk;
2335 u64 host_pat, tsc_this, tsc_base; 2335 u64 host_pat, tsc_this, tsc_base;
2336 unsigned long a; 2336 unsigned long a;
2337 struct descriptor_table dt; 2337 struct desc_ptr dt;
2338 int i; 2338 int i;
2339 unsigned long kvm_vmx_return; 2339 unsigned long kvm_vmx_return;
2340 u32 exec_control; 2340 u32 exec_control;
@@ -2416,7 +2416,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2416 vmcs_write16(HOST_TR_SELECTOR, GDT_ENTRY_TSS*8); /* 22.2.4 */ 2416 vmcs_write16(HOST_TR_SELECTOR, GDT_ENTRY_TSS*8); /* 22.2.4 */
2417 2417
2418 kvm_get_idt(&dt); 2418 kvm_get_idt(&dt);
2419 vmcs_writel(HOST_IDTR_BASE, dt.base); /* 22.2.4 */ 2419 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
2420 2420
2421 asm("mov $.Lkvm_vmx_return, %0" : "=r"(kvm_vmx_return)); 2421 asm("mov $.Lkvm_vmx_return, %0" : "=r"(kvm_vmx_return));
2422 vmcs_writel(HOST_RIP, kvm_vmx_return); /* 22.2.5 */ 2422 vmcs_writel(HOST_RIP, kvm_vmx_return); /* 22.2.5 */