blob: 84395fabc410c9348f1e192ba1dfc1127b1fce30 [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
Glauber Costae32640a2008-03-03 14:12:45 -03007DEFINE_PER_CPU(unsigned long, this_cpu_off);
8EXPORT_PER_CPU_SYMBOL(this_cpu_off);
9
Tejun Heo9939dda2009-01-13 20:41:35 +090010#ifdef CONFIG_X86_32
Alex Nixonfc0091b2008-08-15 17:21:14 +010011/*
12 * Initialize the CPU's GDT. This is either the boot CPU doing itself
13 * (still using the master per-cpu area), or a CPU doing it for a
14 * secondary which will soon come up.
15 */
Glauber Costae32640a2008-03-03 14:12:45 -030016__cpuinit void init_gdt(int cpu)
17{
Alex Nixonfc0091b2008-08-15 17:21:14 +010018 struct desc_struct gdt;
Glauber Costae32640a2008-03-03 14:12:45 -030019
Alex Nixonfc0091b2008-08-15 17:21:14 +010020 pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
Glauber Costae32640a2008-03-03 14:12:45 -030021 0x2 | DESCTYPE_S, 0x8);
Alex Nixonfc0091b2008-08-15 17:21:14 +010022 gdt.s = 1;
Glauber Costae32640a2008-03-03 14:12:45 -030023
Alex Nixonfc0091b2008-08-15 17:21:14 +010024 write_gdt_entry(get_cpu_gdt_table(cpu),
25 GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
Glauber Costae32640a2008-03-03 14:12:45 -030026
Glauber Costae32640a2008-03-03 14:12:45 -030027 per_cpu(cpu_number, cpu) = cpu;
28}
29#endif