Commit 9f9d489a3e78b49d897734eaaf9dea568dbea66e

Authored by Jeremy Fitzhardinge
Committed by Ingo Molnar
1 parent fab58420ac

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>

Showing 5 changed files with 18 additions and 4 deletions Side-by-side Diff

arch/x86/kernel/entry_64.S
... ... @@ -944,7 +944,7 @@
944 944  
945 945 /* Reload gs selector with exception handling */
946 946 /* edi: new selector */
947   -ENTRY(load_gs_index)
  947 +ENTRY(native_load_gs_index)
948 948 CFI_STARTPROC
949 949 pushf
950 950 CFI_ADJUST_CFA_OFFSET 8
... ... @@ -958,7 +958,7 @@
958 958 CFI_ADJUST_CFA_OFFSET -8
959 959 ret
960 960 CFI_ENDPROC
961   -ENDPROC(load_gs_index)
  961 +ENDPROC(native_load_gs_index)
962 962  
963 963 .section __ex_table,"a"
964 964 .align 8
arch/x86/kernel/paravirt.c
... ... @@ -329,6 +329,9 @@
329 329 .store_idt = native_store_idt,
330 330 .store_tr = native_store_tr,
331 331 .load_tls = native_load_tls,
  332 +#ifdef CONFIG_X86_64
  333 + .load_gs_index = native_load_gs_index,
  334 +#endif
332 335 .write_ldt_entry = native_write_ldt_entry,
333 336 .write_gdt_entry = native_write_gdt_entry,
334 337 .write_idt_entry = native_write_idt_entry,
include/asm-x86/elf.h
... ... @@ -83,9 +83,9 @@
83 83 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
84 84  
85 85 #include <asm/processor.h>
  86 +#include <asm/system.h>
86 87  
87 88 #ifdef CONFIG_X86_32
88   -#include <asm/system.h> /* for savesegment */
89 89 #include <asm/desc.h>
90 90  
91 91 #define elf_check_arch(x) elf_check_arch_ia32(x)
include/asm-x86/paravirt.h
... ... @@ -115,6 +115,9 @@
115 115 void (*set_ldt)(const void *desc, unsigned entries);
116 116 unsigned long (*store_tr)(void);
117 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 121 void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
119 122 const void *desc);
120 123 void (*write_gdt_entry)(struct desc_struct *,
... ... @@ -844,6 +847,13 @@
844 847 {
845 848 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu);
846 849 }
  850 +
  851 +#ifdef CONFIG_X86_64
  852 +static inline void load_gs_index(unsigned int gs)
  853 +{
  854 + PVOP_VCALL1(pv_cpu_ops.load_gs_index, gs);
  855 +}
  856 +#endif
847 857  
848 858 static inline void write_ldt_entry(struct desc_struct *dt, int entry,
849 859 const void *desc)
include/asm-x86/system.h
... ... @@ -136,7 +136,7 @@
136 136 #define set_base(ldt, base) _set_base(((char *)&(ldt)) , (base))
137 137 #define set_limit(ldt, limit) _set_limit(((char *)&(ldt)) , ((limit)-1))
138 138  
139   -extern void load_gs_index(unsigned);
  139 +extern void native_load_gs_index(unsigned);
140 140  
141 141 /*
142 142 * Load a segment. Fall back on loading the zero
... ... @@ -282,6 +282,7 @@
282 282 #ifdef CONFIG_X86_64
283 283 #define read_cr8() (native_read_cr8())
284 284 #define write_cr8(x) (native_write_cr8(x))
  285 +#define load_gs_index native_load_gs_index
285 286 #endif
286 287  
287 288 /* Clear the 'TS' bit */