aboutsummaryrefslogtreecommitdiffstats
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
commit75b8bb3e56ca09a467fbbe5229bc68627f7445be (patch)
treeb0eba1d65eb2022fbda902c99edd066b1b3f34da
parent014b15be30c04622d130946ab7c0a9101b523a8a (diff)
x86: change write_ldt_entry signature
this patch changes the signature of write_ldt_entry. 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>
-rw-r--r--arch/x86/kernel/ldt.c3
-rw-r--r--arch/x86/kernel/paravirt_32.c2
-rw-r--r--arch/x86/kernel/vmi_32.c11
-rw-r--r--arch/x86/xen/enlighten.c4
-rw-r--r--include/asm-x86/desc_32.h9
-rw-r--r--include/asm-x86/desc_64.h7
-rw-r--r--include/asm-x86/paravirt.h10
7 files changed, 30 insertions, 16 deletions
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 3e872b468533..b8ef46270e24 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -229,8 +229,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
229 229
230 /* Install the new entry ... */ 230 /* Install the new entry ... */
231install: 231install:
232 write_ldt_entry(mm->context.ldt, ldt_info.entry_number, 232 write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt);
233 ldt.a, ldt.b);
234 error = 0; 233 error = 0;
235 234
236out_unlock: 235out_unlock:
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 77602c1252d7..dd063fba2b21 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -379,7 +379,7 @@ struct pv_cpu_ops pv_cpu_ops = {
379 .store_idt = native_store_idt, 379 .store_idt = native_store_idt,
380 .store_tr = native_store_tr, 380 .store_tr = native_store_tr,
381 .load_tls = native_load_tls, 381 .load_tls = native_load_tls,
382 .write_ldt_entry = write_dt_entry, 382 .write_ldt_entry = native_write_ldt_entry,
383 .write_gdt_entry = native_write_gdt_entry, 383 .write_gdt_entry = native_write_gdt_entry,
384 .write_idt_entry = native_write_idt_entry, 384 .write_idt_entry = native_write_idt_entry,
385 .load_sp0 = native_load_sp0, 385 .load_sp0 = native_load_sp0,
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 21edd0d6eae5..10c46419d35d 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -64,6 +64,7 @@ static struct {
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 (*write_gdt_entry)(struct desc_struct *, int, u32, u32);
67 void (*write_ldt_entry)(struct desc_struct *, int, u32, u32);
67 void (*set_kernel_stack)(u32 selector, u32 sp0); 68 void (*set_kernel_stack)(u32 selector, u32 sp0);
68 void (*allocate_page)(u32, u32, u32, u32, u32); 69 void (*allocate_page)(u32, u32, u32, u32, u32);
69 void (*release_page)(u32, u32); 70 void (*release_page)(u32, u32);
@@ -229,6 +230,13 @@ static void vmi_write_gdt_entry(struct desc_struct *dt, int entry,
229 vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]); 230 vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]);
230} 231}
231 232
233static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
234 const void *desc)
235{
236 u32 *ldt_entry = (u32 *)desc;
237 vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[2]);
238}
239
232static void vmi_load_sp0(struct tss_struct *tss, 240static void vmi_load_sp0(struct tss_struct *tss,
233 struct thread_struct *thread) 241 struct thread_struct *thread)
234{ 242{
@@ -805,7 +813,8 @@ static inline int __init activate_vmi(void)
805 para_fill(pv_cpu_ops.store_idt, GetIDT); 813 para_fill(pv_cpu_ops.store_idt, GetIDT);
806 para_fill(pv_cpu_ops.store_tr, GetTR); 814 para_fill(pv_cpu_ops.store_tr, GetTR);
807 pv_cpu_ops.load_tls = vmi_load_tls; 815 pv_cpu_ops.load_tls = vmi_load_tls;
808 para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); 816 para_wrap(pv_cpu_ops.write_ldt_entry, vmi_write_ldt_entry,
817 write_ldt_entry, WriteLDTEntry);
809 para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry, 818 para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry,
810 write_gdt_entry, WriteGDTEntry); 819 write_gdt_entry, WriteGDTEntry);
811 para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry, 820 para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry,
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7f98c63f6381..72dd14d0685c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -357,11 +357,11 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
357} 357}
358 358
359static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum, 359static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
360 u32 low, u32 high) 360 const void *ptr)
361{ 361{
362 unsigned long lp = (unsigned long)&dt[entrynum]; 362 unsigned long lp = (unsigned long)&dt[entrynum];
363 xmaddr_t mach_lp = virt_to_machine(lp); 363 xmaddr_t mach_lp = virt_to_machine(lp);
364 u64 entry = (u64)high << 32 | low; 364 u64 entry = *(u64 *)ptr;
365 365
366 preempt_disable(); 366 preempt_disable();
367 367
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h
index 41d8214c6173..92a72b0381e2 100644
--- a/include/asm-x86/desc_32.h
+++ b/include/asm-x86/desc_32.h
@@ -69,12 +69,19 @@ static inline void pack_gate(gate_desc *gate,
69#define load_TLS(t, cpu) native_load_tls(t, cpu) 69#define load_TLS(t, cpu) native_load_tls(t, cpu)
70#define set_ldt native_set_ldt 70#define set_ldt native_set_ldt
71 71
72#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 72#define write_ldt_entry(dt, entry, desc) \
73 native_write_ldt_entry(dt, entry, desc)
73#define write_gdt_entry(dt, entry, desc, type) \ 74#define write_gdt_entry(dt, entry, desc, type) \
74 native_write_gdt_entry(dt, entry, desc, type) 75 native_write_gdt_entry(dt, entry, desc, type)
75#define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g) 76#define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g)
76#endif 77#endif
77 78
79static inline void native_write_ldt_entry(struct desc_struct *ldt, int entry,
80 const void *desc)
81{
82 memcpy(&ldt[entry], desc, sizeof(struct desc_struct));
83}
84
78static inline void native_write_idt_entry(gate_desc *idt, int entry, 85static inline void native_write_idt_entry(gate_desc *idt, int entry,
79 const gate_desc *gate) 86 const gate_desc *gate)
80{ 87{
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index ba7fb87d10f3..7cdd3f0420fd 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -34,12 +34,9 @@ extern gate_desc idt_table[];
34extern struct desc_ptr cpu_gdt_descr[]; 34extern struct desc_ptr cpu_gdt_descr[];
35 35
36static inline void write_ldt_entry(struct desc_struct *ldt, 36static inline void write_ldt_entry(struct desc_struct *ldt,
37 int entry, u32 entry_low, u32 entry_high) 37 int entry, void *ptr)
38{ 38{
39 __u32 *lp = (__u32 *)((entry << 3) + (char *)ldt); 39 memcpy(&ldt[entry], ptr, 8);
40
41 lp[0] = entry_low;
42 lp[1] = entry_high;
43} 40}
44 41
45/* the cpu gdt accessor */ 42/* the cpu gdt accessor */
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 3f2abf295e2a..4f23f434a1f3 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -96,8 +96,8 @@ struct pv_cpu_ops {
96 void (*set_ldt)(const void *desc, unsigned entries); 96 void (*set_ldt)(const void *desc, unsigned entries);
97 unsigned long (*store_tr)(void); 97 unsigned long (*store_tr)(void);
98 void (*load_tls)(struct thread_struct *t, unsigned int cpu); 98 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
99 void (*write_ldt_entry)(struct desc_struct *, 99 void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
100 int entrynum, u32 low, u32 high); 100 const void *desc);
101 void (*write_gdt_entry)(struct desc_struct *, 101 void (*write_gdt_entry)(struct desc_struct *,
102 int entrynum, const void *desc, int size); 102 int entrynum, const void *desc, int size);
103 void (*write_idt_entry)(gate_desc *, 103 void (*write_idt_entry)(gate_desc *,
@@ -660,9 +660,11 @@ static inline void load_TLS(struct thread_struct *t, unsigned cpu)
660{ 660{
661 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu); 661 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu);
662} 662}
663static inline void write_ldt_entry(void *dt, int entry, u32 low, u32 high) 663
664static inline void write_ldt_entry(struct desc_struct *dt, int entry,
665 const void *desc)
664{ 666{
665 PVOP_VCALL4(pv_cpu_ops.write_ldt_entry, dt, entry, low, high); 667 PVOP_VCALL3(pv_cpu_ops.write_ldt_entry, dt, entry, desc);
666} 668}
667 669
668static inline void write_gdt_entry(struct desc_struct *dt, int entry, 670static inline void write_gdt_entry(struct desc_struct *dt, int entry,