Commit 8d947344 authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Ingo Molnar

x86: change write_idt_entry signature

this patch changes write_idt_entry signature. It now takes a gate_desc
instead of the a and b parameters. It will allow it to be later unified
between i386 and x86_64.
Signed-off-by: default avatarGlauber de Oliveira Costa <gcosta@redhat.com>
CC: Zachary Amsden <zach@vmware.com>
CC: Jeremy Fitzhardinge <Jeremy.Fitzhardinge.citrix.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 010d4f82
...@@ -381,7 +381,7 @@ struct pv_cpu_ops pv_cpu_ops = { ...@@ -381,7 +381,7 @@ struct pv_cpu_ops pv_cpu_ops = {
.load_tls = native_load_tls, .load_tls = native_load_tls,
.write_ldt_entry = write_dt_entry, .write_ldt_entry = write_dt_entry,
.write_gdt_entry = write_dt_entry, .write_gdt_entry = write_dt_entry,
.write_idt_entry = write_dt_entry, .write_idt_entry = native_write_idt_entry,
.load_sp0 = native_load_sp0, .load_sp0 = native_load_sp0,
.irq_enable_syscall_ret = native_irq_enable_syscall_ret, .irq_enable_syscall_ret = native_irq_enable_syscall_ret,
......
...@@ -62,6 +62,7 @@ static struct { ...@@ -62,6 +62,7 @@ static struct {
void (*cpuid)(void /* non-c */); void (*cpuid)(void /* non-c */);
void (*_set_ldt)(u32 selector); void (*_set_ldt)(u32 selector);
void (*set_tr)(u32 selector); void (*set_tr)(u32 selector);
void (*write_idt_entry)(struct desc_struct *, int, u32, u32);
void (*set_kernel_stack)(u32 selector, u32 sp0); void (*set_kernel_stack)(u32 selector, u32 sp0);
void (*allocate_page)(u32, u32, u32, u32, u32); void (*allocate_page)(u32, u32, u32, u32, u32);
void (*release_page)(u32, u32); void (*release_page)(u32, u32);
...@@ -214,6 +215,12 @@ static void vmi_set_tr(void) ...@@ -214,6 +215,12 @@ static void vmi_set_tr(void)
vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct)); vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct));
} }
static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
{
u32 *idt_entry = (u32 *)g;
vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]);
}
static void vmi_load_sp0(struct tss_struct *tss, static void vmi_load_sp0(struct tss_struct *tss,
struct thread_struct *thread) struct thread_struct *thread)
{ {
...@@ -792,7 +799,8 @@ static inline int __init activate_vmi(void) ...@@ -792,7 +799,8 @@ static inline int __init activate_vmi(void)
pv_cpu_ops.load_tls = vmi_load_tls; pv_cpu_ops.load_tls = vmi_load_tls;
para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry);
para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry);
para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry); para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry,
write_idt_entry, WriteIDTEntry);
para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack); para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack);
para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask);
para_fill(pv_cpu_ops.io_delay, IODelay); para_fill(pv_cpu_ops.io_delay, IODelay);
......
...@@ -217,13 +217,14 @@ static void irq_enable(void) ...@@ -217,13 +217,14 @@ static void irq_enable(void)
* address of the handler, and... well, who cares? The Guest just asks the * address of the handler, and... well, who cares? The Guest just asks the
* Host to make the change anyway, because the Host controls the real IDT. * Host to make the change anyway, because the Host controls the real IDT.
*/ */
static void lguest_write_idt_entry(struct desc_struct *dt, static void lguest_write_idt_entry(gate_desc *dt,
int entrynum, u32 low, u32 high) int entrynum, const gate_desc *g)
{ {
u32 *desc = (u32 *)g;
/* Keep the local copy up to date. */ /* Keep the local copy up to date. */
write_dt_entry(dt, entrynum, low, high); native_write_idt_entry(dt, entrynum, g);
/* Tell Host about this new entry. */ /* Tell Host about this new entry. */
hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, low, high); hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]);
} }
/* Changing to a different IDT is very rare: we keep the IDT up-to-date every /* Changing to a different IDT is very rare: we keep the IDT up-to-date every
......
...@@ -399,8 +399,7 @@ static DEFINE_PER_CPU(struct desc_ptr, idt_desc); ...@@ -399,8 +399,7 @@ static DEFINE_PER_CPU(struct desc_ptr, idt_desc);
/* Set an IDT entry. If the entry is part of the current IDT, then /* Set an IDT entry. If the entry is part of the current IDT, then
also update Xen. */ also update Xen. */
static void xen_write_idt_entry(struct desc_struct *dt, int entrynum, static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g)
u32 low, u32 high)
{ {
unsigned long p = (unsigned long)&dt[entrynum]; unsigned long p = (unsigned long)&dt[entrynum];
unsigned long start, end; unsigned long start, end;
...@@ -412,14 +411,15 @@ static void xen_write_idt_entry(struct desc_struct *dt, int entrynum, ...@@ -412,14 +411,15 @@ static void xen_write_idt_entry(struct desc_struct *dt, int entrynum,
xen_mc_flush(); xen_mc_flush();
write_dt_entry(dt, entrynum, low, high); native_write_idt_entry(dt, entrynum, g);
if (p >= start && (p + 8) <= end) { if (p >= start && (p + 8) <= end) {
struct trap_info info[2]; struct trap_info info[2];
u32 *desc = (u32 *)g;
info[1].address = 0; info[1].address = 0;
if (cvt_gate_to_trap(entrynum, low, high, &info[0])) if (cvt_gate_to_trap(entrynum, desc[0], desc[1], &info[0]))
if (HYPERVISOR_set_trap_table(info)) if (HYPERVISOR_set_trap_table(info))
BUG(); BUG();
} }
......
...@@ -70,9 +70,15 @@ static inline void pack_gate(gate_desc *gate, ...@@ -70,9 +70,15 @@ static inline void pack_gate(gate_desc *gate,
#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) #define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g)
#endif #endif
static inline void native_write_idt_entry(gate_desc *idt, int entry,
const gate_desc *gate)
{
memcpy(&idt[entry], gate, sizeof(*gate));
}
static inline void write_dt_entry(struct desc_struct *dt, static inline void write_dt_entry(struct desc_struct *dt,
int entry, u32 entry_low, u32 entry_high) int entry, u32 entry_low, u32 entry_high)
{ {
...@@ -142,7 +148,7 @@ static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned s ...@@ -142,7 +148,7 @@ static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned s
{ {
gate_desc g; gate_desc g;
pack_gate(&g, (unsigned long)addr, seg, type, 0); pack_gate(&g, (unsigned long)addr, seg, type, 0);
write_idt_entry(idt_table, gate, g.a, g.b); write_idt_entry(idt_table, gate, &g);
} }
static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <asm/kmap_types.h> #include <asm/kmap_types.h>
#include <asm/desc_defs.h>
struct page; struct page;
struct thread_struct; struct thread_struct;
...@@ -99,8 +100,8 @@ struct pv_cpu_ops { ...@@ -99,8 +100,8 @@ struct pv_cpu_ops {
int entrynum, u32 low, u32 high); int entrynum, u32 low, u32 high);
void (*write_gdt_entry)(struct desc_struct *, void (*write_gdt_entry)(struct desc_struct *,
int entrynum, u32 low, u32 high); int entrynum, u32 low, u32 high);
void (*write_idt_entry)(struct desc_struct *, void (*write_idt_entry)(gate_desc *,
int entrynum, u32 low, u32 high); int entrynum, const gate_desc *gate);
void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t);
void (*set_iopl_mask)(unsigned mask); 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,9 +668,9 @@ static inline void write_gdt_entry(void *dt, int entry, u32 low, u32 high)
{ {
PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high); PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high);
} }
static inline void write_idt_entry(void *dt, int entry, u32 low, u32 high) static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
{ {
PVOP_VCALL4(pv_cpu_ops.write_idt_entry, dt, entry, low, high); PVOP_VCALL3(pv_cpu_ops.write_idt_entry, dt, entry, g);
} }
static inline void set_iopl_mask(unsigned mask) static inline void set_iopl_mask(unsigned mask)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment