blob: 99941b37eca0e81e2b44701934e507a7cc74f187 [file] [log] [blame]
Glauber Costae32640a2008-03-03 14:12:45 -03001/*
2 * SMP stuff which is common to all sub-architectures.
3 */
4#include <linux/module.h>
5#include <asm/smp.h>
6
7#ifdef CONFIG_X86_32
8DEFINE_PER_CPU(unsigned long, this_cpu_off);
9EXPORT_PER_CPU_SYMBOL(this_cpu_off);
10
11/* Initialize the CPU's GDT. This is either the boot CPU doing itself
12 (still using the master per-cpu area), or a CPU doing it for a
13 secondary which will soon come up. */
14__cpuinit void init_gdt(int cpu)
15{
16 struct desc_struct *gdt = get_cpu_gdt_table(cpu);
17
18 pack_descriptor(&gdt[GDT_ENTRY_PERCPU],
19 __per_cpu_offset[cpu], 0xFFFFF,
20 0x2 | DESCTYPE_S, 0x8);
21
22 gdt[GDT_ENTRY_PERCPU].s = 1;
23
24 per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
25 per_cpu(cpu_number, cpu) = cpu;
26}
27#endif