aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-06-25 00:19:32 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 07:15:58 -0400
commit9f9d489a3e78b49d897734eaaf9dea568dbea66e (patch)
tree5c3b851701817af0937225bd38602e54ca960868
parentfab58420ac0007a452b540cfb07923225ea4f48d (diff)
x86/paravirt, 64-bit: make load_gs_index() a paravirt operation
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: xen-devel <xen-devel@lists.xensource.com> Cc: Stephen Tweedie <sct@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/paravirt.c3
-rw-r--r--include/asm-x86/elf.h2
-rw-r--r--include/asm-x86/paravirt.h10
-rw-r--r--include/asm-x86/system.h3
5 files changed, 18 insertions, 4 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 70fe13a1c41d..07d69f262337 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -944,7 +944,7 @@ KPROBE_END(error_entry)
944 944
945 /* Reload gs selector with exception handling */ 945 /* Reload gs selector with exception handling */
946 /* edi: new selector */ 946 /* edi: new selector */
947ENTRY(load_gs_index) 947ENTRY(native_load_gs_index)
948 CFI_STARTPROC 948 CFI_STARTPROC
949 pushf 949 pushf
950 CFI_ADJUST_CFA_OFFSET 8 950 CFI_ADJUST_CFA_OFFSET 8
@@ -958,7 +958,7 @@ gs_change:
958 CFI_ADJUST_CFA_OFFSET -8 958 CFI_ADJUST_CFA_OFFSET -8
959 ret 959 ret
960 CFI_ENDPROC 960 CFI_ENDPROC
961ENDPROC(load_gs_index) 961ENDPROC(native_load_gs_index)
962 962
963 .section __ex_table,"a" 963 .section __ex_table,"a"
964 .align 8 964 .align 8
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index b20c369cb89d..27819e3e4245 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -329,6 +329,9 @@ struct pv_cpu_ops pv_cpu_ops = {
329 .store_idt = native_store_idt, 329 .store_idt = native_store_idt,
330 .store_tr = native_store_tr, 330 .store_tr = native_store_tr,
331 .load_tls = native_load_tls, 331 .load_tls = native_load_tls,
332#ifdef CONFIG_X86_64
333 .load_gs_index = native_load_gs_index,
334#endif
332 .write_ldt_entry = native_write_ldt_entry, 335 .write_ldt_entry = native_write_ldt_entry,
333 .write_gdt_entry = native_write_gdt_entry, 336 .write_gdt_entry = native_write_gdt_entry,
334 .write_idt_entry = native_write_idt_entry, 337 .write_idt_entry = native_write_idt_entry,
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
index 8f232dc5b5fe..7be4733c793e 100644
--- a/include/asm-x86/elf.h
+++ b/include/asm-x86/elf.h
@@ -83,9 +83,9 @@ extern unsigned int vdso_enabled;
83 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486)) 83 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
84 84
85#include <asm/processor.h> 85#include <asm/processor.h>
86#include <asm/system.h>
86 87
87#ifdef CONFIG_X86_32 88#ifdef CONFIG_X86_32
88#include <asm/system.h> /* for savesegment */
89#include <asm/desc.h> 89#include <asm/desc.h>
90 90
91#define elf_check_arch(x) elf_check_arch_ia32(x) 91#define elf_check_arch(x) elf_check_arch_ia32(x)
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 3dc223da200b..6d8966f9d190 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -115,6 +115,9 @@ struct pv_cpu_ops {
115 void (*set_ldt)(const void *desc, unsigned entries); 115 void (*set_ldt)(const void *desc, unsigned entries);
116 unsigned long (*store_tr)(void); 116 unsigned long (*store_tr)(void);
117 void (*load_tls)(struct thread_struct *t, unsigned int cpu); 117 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
118#ifdef CONFIG_X86_64
119 void (*load_gs_index)(unsigned int idx);
120#endif
118 void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum, 121 void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
119 const void *desc); 122 const void *desc);
120 void (*write_gdt_entry)(struct desc_struct *, 123 void (*write_gdt_entry)(struct desc_struct *,
@@ -845,6 +848,13 @@ static inline void load_TLS(struct thread_struct *t, unsigned cpu)
845 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu); 848 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu);
846} 849}
847 850
851#ifdef CONFIG_X86_64
852static inline void load_gs_index(unsigned int gs)
853{
854 PVOP_VCALL1(pv_cpu_ops.load_gs_index, gs);
855}
856#endif
857
848static inline void write_ldt_entry(struct desc_struct *dt, int entry, 858static inline void write_ldt_entry(struct desc_struct *dt, int entry,
849 const void *desc) 859 const void *desc)
850{ 860{
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
index f686aa6abfe9..c4946c5964bf 100644
--- a/include/asm-x86/system.h
+++ b/include/asm-x86/system.h
@@ -136,7 +136,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
136#define set_base(ldt, base) _set_base(((char *)&(ldt)) , (base)) 136#define set_base(ldt, base) _set_base(((char *)&(ldt)) , (base))
137#define set_limit(ldt, limit) _set_limit(((char *)&(ldt)) , ((limit)-1)) 137#define set_limit(ldt, limit) _set_limit(((char *)&(ldt)) , ((limit)-1))
138 138
139extern void load_gs_index(unsigned); 139extern void native_load_gs_index(unsigned);
140 140
141/* 141/*
142 * Load a segment. Fall back on loading the zero 142 * Load a segment. Fall back on loading the zero
@@ -282,6 +282,7 @@ static inline void native_wbinvd(void)
282#ifdef CONFIG_X86_64 282#ifdef CONFIG_X86_64
283#define read_cr8() (native_read_cr8()) 283#define read_cr8() (native_read_cr8())
284#define write_cr8(x) (native_write_cr8(x)) 284#define write_cr8(x) (native_write_cr8(x))
285#define load_gs_index native_load_gs_index
285#endif 286#endif
286 287
287/* Clear the 'TS' bit */ 288/* Clear the 'TS' bit */