diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-21 03:26:05 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-21 03:26:05 -0500 |
commit | 0dd76d736eeb3e0ef86c5b103b47ae0e15edebad (patch) | |
tree | 1ab75fceefae986c80dbe1e86a7975df3fb5d9fd /arch | |
parent | 299e26992a737804e13e74fdb97cdab470ed19ac (diff) |
x86: set %fs to __KERNEL_PERCPU unconditionally for x86_32
Impact: cleanup
%fs is currently set to __KERNEL_DS at boot, and conditionally
switched to __KERNEL_PERCPU for secondary cpus. Instead, initialize
GDT_ENTRY_PERCPU to the same attributes as GDT_ENTRY_KERNEL_DS and
set %fs to __KERNEL_PERCPU unconditionally.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/head_32.S | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index a8f0dedcb0cc..fbebbcec001b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -111,7 +111,7 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | |||
111 | [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } }, | 111 | [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } }, |
112 | 112 | ||
113 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, | 113 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, |
114 | [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } }, | 114 | [GDT_ENTRY_PERCPU] = { { { 0x0000ffff, 0x00cf9200 } } }, |
115 | #endif | 115 | #endif |
116 | } }; | 116 | } }; |
117 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | 117 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index e835b4eea70b..24c0e5cd71e3 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -429,12 +429,14 @@ is386: movl $2,%ecx # set MP | |||
429 | ljmp $(__KERNEL_CS),$1f | 429 | ljmp $(__KERNEL_CS),$1f |
430 | 1: movl $(__KERNEL_DS),%eax # reload all the segment registers | 430 | 1: movl $(__KERNEL_DS),%eax # reload all the segment registers |
431 | movl %eax,%ss # after changing gdt. | 431 | movl %eax,%ss # after changing gdt. |
432 | movl %eax,%fs # gets reset once there's real percpu | ||
433 | 432 | ||
434 | movl $(__USER_DS),%eax # DS/ES contains default USER segment | 433 | movl $(__USER_DS),%eax # DS/ES contains default USER segment |
435 | movl %eax,%ds | 434 | movl %eax,%ds |
436 | movl %eax,%es | 435 | movl %eax,%es |
437 | 436 | ||
437 | movl $(__KERNEL_PERCPU), %eax | ||
438 | movl %eax,%fs # set this cpu's percpu | ||
439 | |||
438 | xorl %eax,%eax # Clear GS and LDT | 440 | xorl %eax,%eax # Clear GS and LDT |
439 | movl %eax,%gs | 441 | movl %eax,%gs |
440 | lldt %ax | 442 | lldt %ax |
@@ -446,8 +448,6 @@ is386: movl $2,%ecx # set MP | |||
446 | movb $1, ready | 448 | movb $1, ready |
447 | cmpb $0,%cl # the first CPU calls start_kernel | 449 | cmpb $0,%cl # the first CPU calls start_kernel |
448 | je 1f | 450 | je 1f |
449 | movl $(__KERNEL_PERCPU), %eax | ||
450 | movl %eax,%fs # set this cpu's percpu | ||
451 | movl (stack_start), %esp | 451 | movl (stack_start), %esp |
452 | 1: | 452 | 1: |
453 | #endif /* CONFIG_SMP */ | 453 | #endif /* CONFIG_SMP */ |