diff options
author | Avi Kivity <avi@qumranet.com> | 2008-02-20 10:57:21 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 04:53:24 -0400 |
commit | a5f61300c489e334ddf99781a13a7f8d4b580781 (patch) | |
tree | 54d9587f08ddfc847aebfdff17cb4d6e9ec25ad7 /arch | |
parent | ef2979bd98dac86ea6a4cd9bdd6820a466108017 (diff) |
KVM: Use x86's segment descriptor struct instead of private definition
The x86 desc_struct unification allows us to remove segment_descriptor.h.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/segment_descriptor.h | 29 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 3 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 15 |
3 files changed, 8 insertions, 39 deletions
diff --git a/arch/x86/kvm/segment_descriptor.h b/arch/x86/kvm/segment_descriptor.h deleted file mode 100644 index 56fc4c873389..000000000000 --- a/arch/x86/kvm/segment_descriptor.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #ifndef __SEGMENT_DESCRIPTOR_H | ||
2 | #define __SEGMENT_DESCRIPTOR_H | ||
3 | |||
4 | struct segment_descriptor { | ||
5 | u16 limit_low; | ||
6 | u16 base_low; | ||
7 | u8 base_mid; | ||
8 | u8 type : 4; | ||
9 | u8 system : 1; | ||
10 | u8 dpl : 2; | ||
11 | u8 present : 1; | ||
12 | u8 limit_high : 4; | ||
13 | u8 avl : 1; | ||
14 | u8 long_mode : 1; | ||
15 | u8 default_op : 1; | ||
16 | u8 granularity : 1; | ||
17 | u8 base_high; | ||
18 | } __attribute__((packed)); | ||
19 | |||
20 | #ifdef CONFIG_X86_64 | ||
21 | /* LDT or TSS descriptor in the GDT. 16 bytes. */ | ||
22 | struct segment_descriptor_64 { | ||
23 | struct segment_descriptor s; | ||
24 | u32 base_higher; | ||
25 | u32 pad_zero; | ||
26 | }; | ||
27 | |||
28 | #endif | ||
29 | #endif | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2d5ccec3f9e7..f46ad03c2521 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | #include "irq.h" | 18 | #include "irq.h" |
19 | #include "vmx.h" | 19 | #include "vmx.h" |
20 | #include "segment_descriptor.h" | ||
21 | #include "mmu.h" | 20 | #include "mmu.h" |
22 | 21 | ||
23 | #include <linux/kvm_host.h> | 22 | #include <linux/kvm_host.h> |
@@ -388,7 +387,7 @@ static void reload_tss(void) | |||
388 | * VT restores TR but not its size. Useless. | 387 | * VT restores TR but not its size. Useless. |
389 | */ | 388 | */ |
390 | struct descriptor_table gdt; | 389 | struct descriptor_table gdt; |
391 | struct segment_descriptor *descs; | 390 | struct desc_struct *descs; |
392 | 391 | ||
393 | get_gdt(&gdt); | 392 | get_gdt(&gdt); |
394 | descs = (void *)gdt.base; | 393 | descs = (void *)gdt.base; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b7c32f63671d..a063f449a12e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -15,7 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/kvm_host.h> | 17 | #include <linux/kvm_host.h> |
18 | #include "segment_descriptor.h" | ||
19 | #include "irq.h" | 18 | #include "irq.h" |
20 | #include "mmu.h" | 19 | #include "mmu.h" |
21 | 20 | ||
@@ -29,6 +28,7 @@ | |||
29 | 28 | ||
30 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
31 | #include <asm/msr.h> | 30 | #include <asm/msr.h> |
31 | #include <asm/desc.h> | ||
32 | 32 | ||
33 | #define MAX_IO_MSRS 256 | 33 | #define MAX_IO_MSRS 256 |
34 | #define CR0_RESERVED_BITS \ | 34 | #define CR0_RESERVED_BITS \ |
@@ -94,7 +94,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
94 | unsigned long segment_base(u16 selector) | 94 | unsigned long segment_base(u16 selector) |
95 | { | 95 | { |
96 | struct descriptor_table gdt; | 96 | struct descriptor_table gdt; |
97 | struct segment_descriptor *d; | 97 | struct desc_struct *d; |
98 | unsigned long table_base; | 98 | unsigned long table_base; |
99 | unsigned long v; | 99 | unsigned long v; |
100 | 100 | ||
@@ -110,13 +110,12 @@ unsigned long segment_base(u16 selector) | |||
110 | asm("sldt %0" : "=g"(ldt_selector)); | 110 | asm("sldt %0" : "=g"(ldt_selector)); |
111 | table_base = segment_base(ldt_selector); | 111 | table_base = segment_base(ldt_selector); |
112 | } | 112 | } |
113 | d = (struct segment_descriptor *)(table_base + (selector & ~7)); | 113 | d = (struct desc_struct *)(table_base + (selector & ~7)); |
114 | v = d->base_low | ((unsigned long)d->base_mid << 16) | | 114 | v = d->base0 | ((unsigned long)d->base1 << 16) | |
115 | ((unsigned long)d->base_high << 24); | 115 | ((unsigned long)d->base2 << 24); |
116 | #ifdef CONFIG_X86_64 | 116 | #ifdef CONFIG_X86_64 |
117 | if (d->system == 0 && (d->type == 2 || d->type == 9 || d->type == 11)) | 117 | if (d->s == 0 && (d->type == 2 || d->type == 9 || d->type == 11)) |
118 | v |= ((unsigned long) \ | 118 | v |= ((unsigned long)((struct ldttss_desc64 *)d)->base3) << 32; |
119 | ((struct segment_descriptor_64 *)d)->base_higher) << 32; | ||
120 | #endif | 119 | #endif |
121 | return v; | 120 | return v; |
122 | } | 121 | } |