aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/vmi_32.c
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:31:13 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:13 -0500
commit014b15be30c04622d130946ab7c0a9101b523a8a (patch)
tree9138df88eb59da0021a4ac10c8ce4c66f9a62e13 /arch/x86/kernel/vmi_32.c
parent18245d5b6e54ca76b60b687e43eb893f9e9dd611 (diff)
x86: change write_gdt_entry signature.
This patch changes the write_gdt_entry function signature. Instead of the old "a" and "b" parameters, it now receives a pointer to a desc_struct, and the size of the entry being handled. This is because x86_64 can have some 16-byte entries as well as 8-byte ones. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> CC: Zachary Amsden <zach@vmware.com> CC: Jeremy Fitzhardinge <Jeremy.Fitzhardinge.citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/vmi_32.c')
-rw-r--r--arch/x86/kernel/vmi_32.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index a635b22de25f..21edd0d6eae5 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -63,6 +63,7 @@ static struct {
63 void (*_set_ldt)(u32 selector); 63 void (*_set_ldt)(u32 selector);
64 void (*set_tr)(u32 selector); 64 void (*set_tr)(u32 selector);
65 void (*write_idt_entry)(struct desc_struct *, int, u32, u32); 65 void (*write_idt_entry)(struct desc_struct *, int, u32, u32);
66 void (*write_gdt_entry)(struct desc_struct *, int, u32, u32);
66 void (*set_kernel_stack)(u32 selector, u32 sp0); 67 void (*set_kernel_stack)(u32 selector, u32 sp0);
67 void (*allocate_page)(u32, u32, u32, u32, u32); 68 void (*allocate_page)(u32, u32, u32, u32, u32);
68 void (*release_page)(u32, u32); 69 void (*release_page)(u32, u32);
@@ -187,7 +188,7 @@ static void vmi_cpuid(unsigned int *ax, unsigned int *bx,
187static inline void vmi_maybe_load_tls(struct desc_struct *gdt, int nr, struct desc_struct *new) 188static inline void vmi_maybe_load_tls(struct desc_struct *gdt, int nr, struct desc_struct *new)
188{ 189{
189 if (gdt[nr].a != new->a || gdt[nr].b != new->b) 190 if (gdt[nr].a != new->a || gdt[nr].b != new->b)
190 write_gdt_entry(gdt, nr, new->a, new->b); 191 write_gdt_entry(gdt, nr, new, 0);
191} 192}
192 193
193static void vmi_load_tls(struct thread_struct *t, unsigned int cpu) 194static void vmi_load_tls(struct thread_struct *t, unsigned int cpu)
@@ -201,12 +202,12 @@ static void vmi_load_tls(struct thread_struct *t, unsigned int cpu)
201static void vmi_set_ldt(const void *addr, unsigned entries) 202static void vmi_set_ldt(const void *addr, unsigned entries)
202{ 203{
203 unsigned cpu = smp_processor_id(); 204 unsigned cpu = smp_processor_id();
204 u32 low, high; 205 struct desc_struct desc;
205 206
206 pack_descriptor(&low, &high, (unsigned long)addr, 207 pack_descriptor(&desc, (unsigned long)addr,
207 entries * sizeof(struct desc_struct) - 1, 208 entries * sizeof(struct desc_struct) - 1,
208 DESCTYPE_LDT, 0); 209 DESC_LDT, 0);
209 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, low, high); 210 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, &desc, DESC_LDT);
210 vmi_ops._set_ldt(entries ? GDT_ENTRY_LDT*sizeof(struct desc_struct) : 0); 211 vmi_ops._set_ldt(entries ? GDT_ENTRY_LDT*sizeof(struct desc_struct) : 0);
211} 212}
212 213
@@ -221,6 +222,13 @@ static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
221 vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]); 222 vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]);
222} 223}
223 224
225static void vmi_write_gdt_entry(struct desc_struct *dt, int entry,
226 const void *desc, int type)
227{
228 u32 *gdt_entry = (u32 *)desc;
229 vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]);
230}
231
224static void vmi_load_sp0(struct tss_struct *tss, 232static void vmi_load_sp0(struct tss_struct *tss,
225 struct thread_struct *thread) 233 struct thread_struct *thread)
226{ 234{
@@ -798,7 +806,8 @@ static inline int __init activate_vmi(void)
798 para_fill(pv_cpu_ops.store_tr, GetTR); 806 para_fill(pv_cpu_ops.store_tr, GetTR);
799 pv_cpu_ops.load_tls = vmi_load_tls; 807 pv_cpu_ops.load_tls = vmi_load_tls;
800 para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); 808 para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry);
801 para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); 809 para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry,
810 write_gdt_entry, WriteGDTEntry);
802 para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry, 811 para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry,
803 write_idt_entry, WriteIDTEntry); 812 write_idt_entry, WriteIDTEntry);
804 para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack); 813 para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack);