smpcommon.c 779 B

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