smpcommon.c 676 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * SMP stuff which is common to all sub-architectures.
  3. */
  4. #include <linux/module.h>
  5. #include <asm/smp.h>
  6. DEFINE_PER_CPU(unsigned long, this_cpu_off);
  7. EXPORT_PER_CPU_SYMBOL(this_cpu_off);
  8. #ifdef CONFIG_X86_32
  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(cpu_number, cpu) = cpu;
  23. }
  24. #endif