Commit 75b8bb3e authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Ingo Molnar

x86: change write_ldt_entry signature

this patch changes the signature of write_ldt_entry.
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 014b15be
...@@ -229,8 +229,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) ...@@ -229,8 +229,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
/* Install the new entry ... */ /* Install the new entry ... */
install: install:
write_ldt_entry(mm->context.ldt, ldt_info.entry_number, write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt);
ldt.a, ldt.b);
error = 0; error = 0;
out_unlock: out_unlock:
......
...@@ -379,7 +379,7 @@ struct pv_cpu_ops pv_cpu_ops = { ...@@ -379,7 +379,7 @@ struct pv_cpu_ops pv_cpu_ops = {
.store_idt = native_store_idt, .store_idt = native_store_idt,
.store_tr = native_store_tr, .store_tr = native_store_tr,
.load_tls = native_load_tls, .load_tls = native_load_tls,
.write_ldt_entry = write_dt_entry, .write_ldt_entry = native_write_ldt_entry,
.write_gdt_entry = native_write_gdt_entry, .write_gdt_entry = native_write_gdt_entry,
.write_idt_entry = native_write_idt_entry, .write_idt_entry = native_write_idt_entry,
.load_sp0 = native_load_sp0, .load_sp0 = native_load_sp0,
......
...@@ -64,6 +64,7 @@ static struct { ...@@ -64,6 +64,7 @@ static struct {
void (*set_tr)(u32 selector); void (*set_tr)(u32 selector);
void (*write_idt_entry)(struct desc_struct *, int, u32, u32); void (*write_idt_entry)(struct desc_struct *, int, u32, u32);
void (*write_gdt_entry)(struct desc_struct *, int, u32, u32); void (*write_gdt_entry)(struct desc_struct *, int, u32, u32);
void (*write_ldt_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);
...@@ -229,6 +230,13 @@ static void vmi_write_gdt_entry(struct desc_struct *dt, int entry, ...@@ -229,6 +230,13 @@ static void vmi_write_gdt_entry(struct desc_struct *dt, int entry,
vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]); vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]);
} }
static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
const void *desc)
{
u32 *ldt_entry = (u32 *)desc;
vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_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)
{ {
...@@ -805,7 +813,8 @@ static inline int __init activate_vmi(void) ...@@ -805,7 +813,8 @@ static inline int __init activate_vmi(void)
para_fill(pv_cpu_ops.store_idt, GetIDT); para_fill(pv_cpu_ops.store_idt, GetIDT);
para_fill(pv_cpu_ops.store_tr, GetTR); para_fill(pv_cpu_ops.store_tr, GetTR);
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_wrap(pv_cpu_ops.write_ldt_entry, vmi_write_ldt_entry,
write_ldt_entry, WriteLDTEntry);
para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry, para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry,
write_gdt_entry, WriteGDTEntry); write_gdt_entry, WriteGDTEntry);
para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry, para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry,
......
...@@ -357,11 +357,11 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu) ...@@ -357,11 +357,11 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
} }
static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum, static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
u32 low, u32 high) const void *ptr)
{ {
unsigned long lp = (unsigned long)&dt[entrynum]; unsigned long lp = (unsigned long)&dt[entrynum];
xmaddr_t mach_lp = virt_to_machine(lp); xmaddr_t mach_lp = virt_to_machine(lp);
u64 entry = (u64)high << 32 | low; u64 entry = *(u64 *)ptr;
preempt_disable(); preempt_disable();
......
...@@ -69,12 +69,19 @@ static inline void pack_gate(gate_desc *gate, ...@@ -69,12 +69,19 @@ static inline void pack_gate(gate_desc *gate,
#define load_TLS(t, cpu) native_load_tls(t, cpu) #define load_TLS(t, cpu) native_load_tls(t, cpu)
#define set_ldt native_set_ldt #define set_ldt native_set_ldt
#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) #define write_ldt_entry(dt, entry, desc) \
native_write_ldt_entry(dt, entry, desc)
#define write_gdt_entry(dt, entry, desc, type) \ #define write_gdt_entry(dt, entry, desc, type) \
native_write_gdt_entry(dt, entry, desc, type) native_write_gdt_entry(dt, entry, desc, type)
#define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g) #define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g)
#endif #endif
static inline void native_write_ldt_entry(struct desc_struct *ldt, int entry,
const void *desc)
{
memcpy(&ldt[entry], desc, sizeof(struct desc_struct));
}
static inline void native_write_idt_entry(gate_desc *idt, int entry, static inline void native_write_idt_entry(gate_desc *idt, int entry,
const gate_desc *gate) const gate_desc *gate)
{ {
......
...@@ -34,12 +34,9 @@ extern gate_desc idt_table[]; ...@@ -34,12 +34,9 @@ extern gate_desc idt_table[];
extern struct desc_ptr cpu_gdt_descr[]; extern struct desc_ptr cpu_gdt_descr[];
static inline void write_ldt_entry(struct desc_struct *ldt, static inline void write_ldt_entry(struct desc_struct *ldt,
int entry, u32 entry_low, u32 entry_high) int entry, void *ptr)
{ {
__u32 *lp = (__u32 *)((entry << 3) + (char *)ldt); memcpy(&ldt[entry], ptr, 8);
lp[0] = entry_low;
lp[1] = entry_high;
} }
/* the cpu gdt accessor */ /* the cpu gdt accessor */
......
...@@ -96,8 +96,8 @@ struct pv_cpu_ops { ...@@ -96,8 +96,8 @@ struct pv_cpu_ops {
void (*set_ldt)(const void *desc, unsigned entries); void (*set_ldt)(const void *desc, unsigned entries);
unsigned long (*store_tr)(void); unsigned long (*store_tr)(void);
void (*load_tls)(struct thread_struct *t, unsigned int cpu); void (*load_tls)(struct thread_struct *t, unsigned int cpu);
void (*write_ldt_entry)(struct desc_struct *, void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
int entrynum, u32 low, u32 high); const void *desc);
void (*write_gdt_entry)(struct desc_struct *, void (*write_gdt_entry)(struct desc_struct *,
int entrynum, const void *desc, int size); int entrynum, const void *desc, int size);
void (*write_idt_entry)(gate_desc *, void (*write_idt_entry)(gate_desc *,
...@@ -660,9 +660,11 @@ static inline void load_TLS(struct thread_struct *t, unsigned cpu) ...@@ -660,9 +660,11 @@ static inline void load_TLS(struct thread_struct *t, unsigned cpu)
{ {
PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu); PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu);
} }
static inline void write_ldt_entry(void *dt, int entry, u32 low, u32 high)
static inline void write_ldt_entry(struct desc_struct *dt, int entry,
const void *desc)
{ {
PVOP_VCALL4(pv_cpu_ops.write_ldt_entry, dt, entry, low, high); PVOP_VCALL3(pv_cpu_ops.write_ldt_entry, dt, entry, desc);
} }
static inline void write_gdt_entry(struct desc_struct *dt, int entry, static inline void write_gdt_entry(struct desc_struct *dt, int entry,
......
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