blob: add36b4e37c92d00eabe22f25ab0148febfcb2e2 [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>
Tejun Heocd3adf52009-01-16 12:11:43 +09006#include <asm/sections.h>
Glauber Costae32640a2008-03-03 14:12:45 -03007
Tejun Heocd3adf52009-01-16 12:11:43 +09008#ifdef CONFIG_X86_64
9DEFINE_PER_CPU(unsigned long, this_cpu_off) = (unsigned long)__per_cpu_load;
10#else
Glauber Costae32640a2008-03-03 14:12:45 -030011DEFINE_PER_CPU(unsigned long, this_cpu_off);
Tejun Heocd3adf52009-01-16 12:11:43 +090012#endif
Glauber Costae32640a2008-03-03 14:12:45 -030013EXPORT_PER_CPU_SYMBOL(this_cpu_off);
14
Tejun Heo9939dda2009-01-13 20:41:35 +090015#ifdef CONFIG_X86_32
Alex Nixonfc0091b2008-08-15 17:21:14 +010016/*
17 * Initialize the CPU's GDT. This is either the boot CPU doing itself
18 * (still using the master per-cpu area), or a CPU doing it for a
19 * secondary which will soon come up.
20 */
Glauber Costae32640a2008-03-03 14:12:45 -030021__cpuinit void init_gdt(int cpu)
22{
Alex Nixonfc0091b2008-08-15 17:21:14 +010023 struct desc_struct gdt;
Glauber Costae32640a2008-03-03 14:12:45 -030024
Alex Nixonfc0091b2008-08-15 17:21:14 +010025 pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
Glauber Costae32640a2008-03-03 14:12:45 -030026 0x2 | DESCTYPE_S, 0x8);
Alex Nixonfc0091b2008-08-15 17:21:14 +010027 gdt.s = 1;
Glauber Costae32640a2008-03-03 14:12:45 -030028
Alex Nixonfc0091b2008-08-15 17:21:14 +010029 write_gdt_entry(get_cpu_gdt_table(cpu),
30 GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
Glauber Costae32640a2008-03-03 14:12:45 -030031}
32#endif