aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup_percpu.c
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2009-01-26 22:56:48 -0500
committerTejun Heo <tj@kernel.org>2009-01-26 22:56:48 -0500
commitb2d2f4312b117a6cc647c8521e2643a88771f757 (patch)
treecf512c6ed0cfc5081f095cfa1da974b1566bb043 /arch/x86/kernel/setup_percpu.c
parent89c9c4c58ee86e6e8802597271f23679e0c46647 (diff)
x86: initialize per-cpu GDT segment in per-cpu setup
Impact: cleanup Rename init_gdt() to setup_percpu_segment(), and move it to setup_percpu.c. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel/setup_percpu.c')
-rw-r--r--arch/x86/kernel/setup_percpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 599dc1cc1da8..bcca3a7b3748 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -40,6 +40,19 @@ unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = {
40}; 40};
41EXPORT_SYMBOL(__per_cpu_offset); 41EXPORT_SYMBOL(__per_cpu_offset);
42 42
43static inline void setup_percpu_segment(int cpu)
44{
45#ifdef CONFIG_X86_32
46 struct desc_struct gdt;
47
48 pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF,
49 0x2 | DESCTYPE_S, 0x8);
50 gdt.s = 1;
51 write_gdt_entry(get_cpu_gdt_table(cpu),
52 GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
53#endif
54}
55
43/* 56/*
44 * Great future plan: 57 * Great future plan:
45 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data. 58 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
@@ -81,6 +94,7 @@ void __init setup_per_cpu_areas(void)
81 per_cpu_offset(cpu) = ptr - __per_cpu_start; 94 per_cpu_offset(cpu) = ptr - __per_cpu_start;
82 per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu); 95 per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
83 per_cpu(cpu_number, cpu) = cpu; 96 per_cpu(cpu_number, cpu) = cpu;
97 setup_percpu_segment(cpu);
84 /* 98 /*
85 * Copy data used in early init routines from the initial arrays to the 99 * Copy data used in early init routines from the initial arrays to the
86 * per cpu data areas. These arrays then become expendable and the 100 * per cpu data areas. These arrays then become expendable and the