smpcommon.c 709 B

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