smpcommon.c 729 B

123456789101112131415161718192021222324252627282930
  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. /*
  10. * Initialize the CPU's GDT. This is either the boot CPU doing itself
  11. * (still using the master per-cpu area), or a CPU doing it for a
  12. * secondary which will soon come up.
  13. */
  14. __cpuinit void init_gdt(int cpu)
  15. {
  16. struct desc_struct gdt;
  17. pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
  18. 0x2 | DESCTYPE_S, 0x8);
  19. gdt.s = 1;
  20. write_gdt_entry(get_cpu_gdt_table(cpu),
  21. GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
  22. per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
  23. per_cpu(cpu_number, cpu) = cpu;
  24. }
  25. #endif