aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup_percpu.c
diff options
context:
space:
mode:
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