diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-18 22:21:28 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-19 22:29:20 -0500 |
commit | 8c7e58e690ae60ab4215b025f433ed4af261e103 (patch) | |
tree | 2fd7fa19b8c34908e25ba223b8518d44504962e4 /arch/x86/kernel/head_64.S | |
parent | 0bd74fa8e29dcad98f7e8ffe01ec05fb3326abaf (diff) |
x86: rework __per_cpu_load adjustments
Impact: cleanup
Use cpu_number to determine if the adjustment is necessary.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel/head_64.S')
-rw-r--r-- | arch/x86/kernel/head_64.S | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index c8ace880661b..98ea26a2fca1 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -207,19 +207,15 @@ ENTRY(secondary_startup_64) | |||
207 | 207 | ||
208 | #ifdef CONFIG_SMP | 208 | #ifdef CONFIG_SMP |
209 | /* | 209 | /* |
210 | * early_gdt_base should point to the gdt_page in static percpu init | 210 | * Fix up static pointers that need __per_cpu_load added. The assembler |
211 | * data area. Computing this requires two symbols - __per_cpu_load | 211 | * is unable to do this directly. This is only needed for the boot cpu. |
212 | * and per_cpu__gdt_page. As linker can't do no such relocation, do | 212 | * These values are set up with the correct base addresses by C code for |
213 | * it by hand. As early_gdt_descr is manipulated by C code for | 213 | * secondary cpus. |
214 | * secondary CPUs, this should be done only once for the boot CPU | ||
215 | * when early_gdt_descr_base contains zero. | ||
216 | */ | 214 | */ |
217 | movq early_gdt_descr_base(%rip), %rax | 215 | movq initial_gs(%rip), %rax |
218 | testq %rax, %rax | 216 | cmpl $0, per_cpu__cpu_number(%rax) |
219 | jnz 1f | 217 | jne 1f |
220 | movq $__per_cpu_load, %rax | 218 | addq %rax, early_gdt_descr_base(%rip) |
221 | addq $per_cpu__gdt_page, %rax | ||
222 | movq %rax, early_gdt_descr_base(%rip) | ||
223 | 1: | 219 | 1: |
224 | #endif | 220 | #endif |
225 | /* | 221 | /* |
@@ -431,12 +427,8 @@ NEXT_PAGE(level2_spare_pgt) | |||
431 | .globl early_gdt_descr | 427 | .globl early_gdt_descr |
432 | early_gdt_descr: | 428 | early_gdt_descr: |
433 | .word GDT_ENTRIES*8-1 | 429 | .word GDT_ENTRIES*8-1 |
434 | #ifdef CONFIG_SMP | ||
435 | early_gdt_descr_base: | 430 | early_gdt_descr_base: |
436 | .quad 0x0000000000000000 | ||
437 | #else | ||
438 | .quad per_cpu__gdt_page | 431 | .quad per_cpu__gdt_page |
439 | #endif | ||
440 | 432 | ||
441 | ENTRY(phys_base) | 433 | ENTRY(phys_base) |
442 | /* This must match the first entry in level2_kernel_pgt */ | 434 | /* This must match the first entry in level2_kernel_pgt */ |