diff options
-rw-r--r-- | arch/x86/kernel/paravirt_32.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/vmi_32.c | 10 | ||||
-rw-r--r-- | arch/x86/lguest/boot.c | 9 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 8 | ||||
-rw-r--r-- | include/asm-x86/desc_32.h | 10 | ||||
-rw-r--r-- | include/asm-x86/paravirt.h | 9 |
6 files changed, 32 insertions, 16 deletions
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c index f4e3a8e01cf2..13bbc99b639b 100644 --- a/arch/x86/kernel/paravirt_32.c +++ b/arch/x86/kernel/paravirt_32.c | |||
@@ -381,7 +381,7 @@ struct pv_cpu_ops pv_cpu_ops = { | |||
381 | .load_tls = native_load_tls, | 381 | .load_tls = native_load_tls, |
382 | .write_ldt_entry = write_dt_entry, | 382 | .write_ldt_entry = write_dt_entry, |
383 | .write_gdt_entry = write_dt_entry, | 383 | .write_gdt_entry = write_dt_entry, |
384 | .write_idt_entry = write_dt_entry, | 384 | .write_idt_entry = native_write_idt_entry, |
385 | .load_sp0 = native_load_sp0, | 385 | .load_sp0 = native_load_sp0, |
386 | 386 | ||
387 | .irq_enable_syscall_ret = native_irq_enable_syscall_ret, | 387 | .irq_enable_syscall_ret = native_irq_enable_syscall_ret, |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 4cfda7dbe90f..a635b22de25f 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -62,6 +62,7 @@ static struct { | |||
62 | void (*cpuid)(void /* non-c */); | 62 | void (*cpuid)(void /* non-c */); |
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 (*set_kernel_stack)(u32 selector, u32 sp0); | 66 | void (*set_kernel_stack)(u32 selector, u32 sp0); |
66 | void (*allocate_page)(u32, u32, u32, u32, u32); | 67 | void (*allocate_page)(u32, u32, u32, u32, u32); |
67 | void (*release_page)(u32, u32); | 68 | void (*release_page)(u32, u32); |
@@ -214,6 +215,12 @@ static void vmi_set_tr(void) | |||
214 | vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct)); | 215 | vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct)); |
215 | } | 216 | } |
216 | 217 | ||
218 | static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) | ||
219 | { | ||
220 | u32 *idt_entry = (u32 *)g; | ||
221 | vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]); | ||
222 | } | ||
223 | |||
217 | static void vmi_load_sp0(struct tss_struct *tss, | 224 | static void vmi_load_sp0(struct tss_struct *tss, |
218 | struct thread_struct *thread) | 225 | struct thread_struct *thread) |
219 | { | 226 | { |
@@ -792,7 +799,8 @@ static inline int __init activate_vmi(void) | |||
792 | pv_cpu_ops.load_tls = vmi_load_tls; | 799 | pv_cpu_ops.load_tls = vmi_load_tls; |
793 | para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); | 800 | para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); |
794 | para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); | 801 | para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); |
795 | para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry); | 802 | para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry, |
803 | write_idt_entry, WriteIDTEntry); | ||
796 | para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack); | 804 | para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack); |
797 | para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); | 805 | para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); |
798 | para_fill(pv_cpu_ops.io_delay, IODelay); | 806 | para_fill(pv_cpu_ops.io_delay, IODelay); |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index aa0bdd5fc4bb..b50c8ad25ab4 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -217,13 +217,14 @@ static void irq_enable(void) | |||
217 | * address of the handler, and... well, who cares? The Guest just asks the | 217 | * address of the handler, and... well, who cares? The Guest just asks the |
218 | * Host to make the change anyway, because the Host controls the real IDT. | 218 | * Host to make the change anyway, because the Host controls the real IDT. |
219 | */ | 219 | */ |
220 | static void lguest_write_idt_entry(struct desc_struct *dt, | 220 | static void lguest_write_idt_entry(gate_desc *dt, |
221 | int entrynum, u32 low, u32 high) | 221 | int entrynum, const gate_desc *g) |
222 | { | 222 | { |
223 | u32 *desc = (u32 *)g; | ||
223 | /* Keep the local copy up to date. */ | 224 | /* Keep the local copy up to date. */ |
224 | write_dt_entry(dt, entrynum, low, high); | 225 | native_write_idt_entry(dt, entrynum, g); |
225 | /* Tell Host about this new entry. */ | 226 | /* Tell Host about this new entry. */ |
226 | hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, low, high); | 227 | hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]); |
227 | } | 228 | } |
228 | 229 | ||
229 | /* Changing to a different IDT is very rare: we keep the IDT up-to-date every | 230 | /* Changing to a different IDT is very rare: we keep the IDT up-to-date every |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index c32e0fd0f838..b7b7346d8cdc 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -399,8 +399,7 @@ static DEFINE_PER_CPU(struct desc_ptr, idt_desc); | |||
399 | 399 | ||
400 | /* Set an IDT entry. If the entry is part of the current IDT, then | 400 | /* Set an IDT entry. If the entry is part of the current IDT, then |
401 | also update Xen. */ | 401 | also update Xen. */ |
402 | static void xen_write_idt_entry(struct desc_struct *dt, int entrynum, | 402 | static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g) |
403 | u32 low, u32 high) | ||
404 | { | 403 | { |
405 | unsigned long p = (unsigned long)&dt[entrynum]; | 404 | unsigned long p = (unsigned long)&dt[entrynum]; |
406 | unsigned long start, end; | 405 | unsigned long start, end; |
@@ -412,14 +411,15 @@ static void xen_write_idt_entry(struct desc_struct *dt, int entrynum, | |||
412 | 411 | ||
413 | xen_mc_flush(); | 412 | xen_mc_flush(); |
414 | 413 | ||
415 | write_dt_entry(dt, entrynum, low, high); | 414 | native_write_idt_entry(dt, entrynum, g); |
416 | 415 | ||
417 | if (p >= start && (p + 8) <= end) { | 416 | if (p >= start && (p + 8) <= end) { |
418 | struct trap_info info[2]; | 417 | struct trap_info info[2]; |
418 | u32 *desc = (u32 *)g; | ||
419 | 419 | ||
420 | info[1].address = 0; | 420 | info[1].address = 0; |
421 | 421 | ||
422 | if (cvt_gate_to_trap(entrynum, low, high, &info[0])) | 422 | if (cvt_gate_to_trap(entrynum, desc[0], desc[1], &info[0])) |
423 | if (HYPERVISOR_set_trap_table(info)) | 423 | if (HYPERVISOR_set_trap_table(info)) |
424 | BUG(); | 424 | BUG(); |
425 | } | 425 | } |
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h index 77f1e5a4ad7c..54b2314f2ddf 100644 --- a/include/asm-x86/desc_32.h +++ b/include/asm-x86/desc_32.h | |||
@@ -70,9 +70,15 @@ static inline void pack_gate(gate_desc *gate, | |||
70 | 70 | ||
71 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 71 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
72 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 72 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
73 | #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 73 | #define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g) |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | static inline void native_write_idt_entry(gate_desc *idt, int entry, | ||
77 | const gate_desc *gate) | ||
78 | { | ||
79 | memcpy(&idt[entry], gate, sizeof(*gate)); | ||
80 | } | ||
81 | |||
76 | static inline void write_dt_entry(struct desc_struct *dt, | 82 | static inline void write_dt_entry(struct desc_struct *dt, |
77 | int entry, u32 entry_low, u32 entry_high) | 83 | int entry, u32 entry_low, u32 entry_high) |
78 | { | 84 | { |
@@ -142,7 +148,7 @@ static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned s | |||
142 | { | 148 | { |
143 | gate_desc g; | 149 | gate_desc g; |
144 | pack_gate(&g, (unsigned long)addr, seg, type, 0); | 150 | pack_gate(&g, (unsigned long)addr, seg, type, 0); |
145 | write_idt_entry(idt_table, gate, g.a, g.b); | 151 | write_idt_entry(idt_table, gate, &g); |
146 | } | 152 | } |
147 | 153 | ||
148 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) | 154 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) |
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index 0333fb6988b5..86a9d7b0920f 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/cpumask.h> | 18 | #include <linux/cpumask.h> |
19 | #include <asm/kmap_types.h> | 19 | #include <asm/kmap_types.h> |
20 | #include <asm/desc_defs.h> | ||
20 | 21 | ||
21 | struct page; | 22 | struct page; |
22 | struct thread_struct; | 23 | struct thread_struct; |
@@ -99,8 +100,8 @@ struct pv_cpu_ops { | |||
99 | int entrynum, u32 low, u32 high); | 100 | int entrynum, u32 low, u32 high); |
100 | void (*write_gdt_entry)(struct desc_struct *, | 101 | void (*write_gdt_entry)(struct desc_struct *, |
101 | int entrynum, u32 low, u32 high); | 102 | int entrynum, u32 low, u32 high); |
102 | void (*write_idt_entry)(struct desc_struct *, | 103 | void (*write_idt_entry)(gate_desc *, |
103 | int entrynum, u32 low, u32 high); | 104 | int entrynum, const gate_desc *gate); |
104 | void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); | 105 | void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); |
105 | 106 | ||
106 | void (*set_iopl_mask)(unsigned mask); | 107 | void (*set_iopl_mask)(unsigned mask); |
@@ -667,9 +668,9 @@ static inline void write_gdt_entry(void *dt, int entry, u32 low, u32 high) | |||
667 | { | 668 | { |
668 | PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high); | 669 | PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high); |
669 | } | 670 | } |
670 | static inline void write_idt_entry(void *dt, int entry, u32 low, u32 high) | 671 | static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) |
671 | { | 672 | { |
672 | PVOP_VCALL4(pv_cpu_ops.write_idt_entry, dt, entry, low, high); | 673 | PVOP_VCALL3(pv_cpu_ops.write_idt_entry, dt, entry, g); |
673 | } | 674 | } |
674 | static inline void set_iopl_mask(unsigned mask) | 675 | static inline void set_iopl_mask(unsigned mask) |
675 | { | 676 | { |