aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2007-02-13 07:26:20 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-02-13 07:26:20 -0500
commit464d1a78fbf8cf6c7fd970e7b3e2db50a320ce28 (patch)
tree536d8a92976e675b484b35dec88d40c97fab8ac8 /include/asm-i386
parent54413927f022292aeccadd268fbf1c0b42129945 (diff)
[PATCH] i386: Convert i386 PDA code to use %fs
Convert the PDA code to use %fs rather than %gs as the segment for per-processor data. This is because some processors show a small but measurable performance gain for reloading a NULL segment selector (as %fs generally is in user-space) versus a non-NULL one (as %gs generally is). On modern processors the difference is very small, perhaps undetectable. Some old AMD "K6 3D+" processors are noticably slower when %fs is used rather than %gs; I have no idea why this might be, but I think they're sufficiently rare that it doesn't matter much. This patch also fixes the math emulator, which had not been adjusted to match the changed struct pt_regs. [frederik.deweerdt@gmail.com: fixit with gdb] [mingo@elte.hu: Fix KVM too] Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Ian Campbell <Ian.Campbell@XenSource.com> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Zachary Amsden <zach@vmware.com> Cc: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'include/asm-i386')
-rw-r--r--include/asm-i386/elf.h4
-rw-r--r--include/asm-i386/mmu_context.h2
-rw-r--r--include/asm-i386/pda.h12
-rw-r--r--include/asm-i386/processor.h6
-rw-r--r--include/asm-i386/ptrace.h4
5 files changed, 14 insertions, 14 deletions
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 369035dfe4b6..8d33c9bb7c1c 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -90,8 +90,8 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
90 pr_reg[6] = regs->eax; \ 90 pr_reg[6] = regs->eax; \
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes; \
93 savesegment(fs,pr_reg[9]); \ 93 pr_reg[9] = regs->xfs; \
94 pr_reg[10] = regs->xgs; \ 94 savesegment(gs,pr_reg[10]); \
95 pr_reg[11] = regs->orig_eax; \ 95 pr_reg[11] = regs->orig_eax; \
96 pr_reg[12] = regs->eip; \ 96 pr_reg[12] = regs->eip; \
97 pr_reg[13] = regs->xcs; \ 97 pr_reg[13] = regs->xcs; \
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 68ff102d6f5e..e6aa30f8de5b 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -63,7 +63,7 @@ static inline void switch_mm(struct mm_struct *prev,
63} 63}
64 64
65#define deactivate_mm(tsk, mm) \ 65#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%fs": :"r" (0)); 66 asm("movl %0,%%gs": :"r" (0));
67 67
68#define activate_mm(prev, next) \ 68#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 69 switch_mm((prev),(next),NULL)
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h
index 2ba2736aa109..b12d59a318b7 100644
--- a/include/asm-i386/pda.h
+++ b/include/asm-i386/pda.h
@@ -39,19 +39,19 @@ extern struct i386_pda _proxy_pda;
39 if (0) { T__ tmp__; tmp__ = (val); } \ 39 if (0) { T__ tmp__; tmp__ = (val); } \
40 switch (sizeof(_proxy_pda.field)) { \ 40 switch (sizeof(_proxy_pda.field)) { \
41 case 1: \ 41 case 1: \
42 asm(op "b %1,%%gs:%c2" \ 42 asm(op "b %1,%%fs:%c2" \
43 : "+m" (_proxy_pda.field) \ 43 : "+m" (_proxy_pda.field) \
44 :"ri" ((T__)val), \ 44 :"ri" ((T__)val), \
45 "i"(pda_offset(field))); \ 45 "i"(pda_offset(field))); \
46 break; \ 46 break; \
47 case 2: \ 47 case 2: \
48 asm(op "w %1,%%gs:%c2" \ 48 asm(op "w %1,%%fs:%c2" \
49 : "+m" (_proxy_pda.field) \ 49 : "+m" (_proxy_pda.field) \
50 :"ri" ((T__)val), \ 50 :"ri" ((T__)val), \
51 "i"(pda_offset(field))); \ 51 "i"(pda_offset(field))); \
52 break; \ 52 break; \
53 case 4: \ 53 case 4: \
54 asm(op "l %1,%%gs:%c2" \ 54 asm(op "l %1,%%fs:%c2" \
55 : "+m" (_proxy_pda.field) \ 55 : "+m" (_proxy_pda.field) \
56 :"ri" ((T__)val), \ 56 :"ri" ((T__)val), \
57 "i"(pda_offset(field))); \ 57 "i"(pda_offset(field))); \
@@ -65,19 +65,19 @@ extern struct i386_pda _proxy_pda;
65 typeof(_proxy_pda.field) ret__; \ 65 typeof(_proxy_pda.field) ret__; \
66 switch (sizeof(_proxy_pda.field)) { \ 66 switch (sizeof(_proxy_pda.field)) { \
67 case 1: \ 67 case 1: \
68 asm(op "b %%gs:%c1,%0" \ 68 asm(op "b %%fs:%c1,%0" \
69 : "=r" (ret__) \ 69 : "=r" (ret__) \
70 : "i" (pda_offset(field)), \ 70 : "i" (pda_offset(field)), \
71 "m" (_proxy_pda.field)); \ 71 "m" (_proxy_pda.field)); \
72 break; \ 72 break; \
73 case 2: \ 73 case 2: \
74 asm(op "w %%gs:%c1,%0" \ 74 asm(op "w %%fs:%c1,%0" \
75 : "=r" (ret__) \ 75 : "=r" (ret__) \
76 : "i" (pda_offset(field)), \ 76 : "i" (pda_offset(field)), \
77 "m" (_proxy_pda.field)); \ 77 "m" (_proxy_pda.field)); \
78 break; \ 78 break; \
79 case 4: \ 79 case 4: \
80 asm(op "l %%gs:%c1,%0" \ 80 asm(op "l %%fs:%c1,%0" \
81 : "=r" (ret__) \ 81 : "=r" (ret__) \
82 : "i" (pda_offset(field)), \ 82 : "i" (pda_offset(field)), \
83 "m" (_proxy_pda.field)); \ 83 "m" (_proxy_pda.field)); \
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 359f10b54f59..11bf899de8aa 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -424,7 +424,7 @@ struct thread_struct {
424 .vm86_info = NULL, \ 424 .vm86_info = NULL, \
425 .sysenter_cs = __KERNEL_CS, \ 425 .sysenter_cs = __KERNEL_CS, \
426 .io_bitmap_ptr = NULL, \ 426 .io_bitmap_ptr = NULL, \
427 .gs = __KERNEL_PDA, \ 427 .fs = __KERNEL_PDA, \
428} 428}
429 429
430/* 430/*
@@ -442,8 +442,8 @@ struct thread_struct {
442} 442}
443 443
444#define start_thread(regs, new_eip, new_esp) do { \ 444#define start_thread(regs, new_eip, new_esp) do { \
445 __asm__("movl %0,%%fs": :"r" (0)); \ 445 __asm__("movl %0,%%gs": :"r" (0)); \
446 regs->xgs = 0; \ 446 regs->xfs = 0; \
447 set_fs(USER_DS); \ 447 set_fs(USER_DS); \
448 regs->xds = __USER_DS; \ 448 regs->xds = __USER_DS; \
449 regs->xes = __USER_DS; \ 449 regs->xes = __USER_DS; \
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index bdbc894339b4..1646996c73da 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -16,8 +16,8 @@ struct pt_regs {
16 long eax; 16 long eax;
17 int xds; 17 int xds;
18 int xes; 18 int xes;
19 /* int xfs; */ 19 int xfs;
20 int xgs; 20 /* int xgs; */
21 long orig_eax; 21 long orig_eax;
22 long eip; 22 long eip;
23 int xcs; 23 int xcs;