| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 1 | /* |
| 2 | * SMP stuff which is common to all sub-architectures. |
| 3 | */ |
| 4 | #include <linux/module.h> |
| 5 | #include <asm/smp.h> |
| Tejun Heo | cd3adf5 | 2009-01-16 12:11:43 +0900 | [diff] [blame] | 6 | #include <asm/sections.h> |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 7 | |
| Tejun Heo | cd3adf5 | 2009-01-16 12:11:43 +0900 | [diff] [blame] | 8 | #ifdef CONFIG_X86_64 |
| 9 | DEFINE_PER_CPU(unsigned long, this_cpu_off) = (unsigned long)__per_cpu_load; |
| 10 | #else |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 11 | DEFINE_PER_CPU(unsigned long, this_cpu_off); |
| Tejun Heo | cd3adf5 | 2009-01-16 12:11:43 +0900 | [diff] [blame] | 12 | #endif |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 13 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); |
| 14 | |
| Tejun Heo | 9939dda | 2009-01-13 20:41:35 +0900 | [diff] [blame] | 15 | #ifdef CONFIG_X86_32 |
| Alex Nixon | fc0091b | 2008-08-15 17:21:14 +0100 | [diff] [blame] | 16 | /* |
| 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 Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 21 | __cpuinit void init_gdt(int cpu) |
| 22 | { |
| Alex Nixon | fc0091b | 2008-08-15 17:21:14 +0100 | [diff] [blame] | 23 | struct desc_struct gdt; |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 24 | |
| Alex Nixon | fc0091b | 2008-08-15 17:21:14 +0100 | [diff] [blame] | 25 | pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF, |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 26 | 0x2 | DESCTYPE_S, 0x8); |
| Alex Nixon | fc0091b | 2008-08-15 17:21:14 +0100 | [diff] [blame] | 27 | gdt.s = 1; |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 28 | |
| Alex Nixon | fc0091b | 2008-08-15 17:21:14 +0100 | [diff] [blame] | 29 | write_gdt_entry(get_cpu_gdt_table(cpu), |
| 30 | GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); |
| Glauber Costa | e32640a | 2008-03-03 14:12:45 -0300 | [diff] [blame] | 31 | } |
| 32 | #endif |