tss.h 832 B

123456789101112131415161718192021222324252627
  1. /* TSS + per-CPU flat GDT.
  2. *
  3. * Layout: 0x00 null, 0x08 kernel code, 0x10 kernel data, 0x18 user code,
  4. * 0x20 user data, 0x28 per-CPU data (GS base), 0x30 + 8*cpu TSS.
  5. * Every CPU gets its own GDT because the GS descriptor base differs.
  6. */
  7. #ifndef TSS_H
  8. #define TSS_H
  9. struct tss {
  10. unsigned int prev_tss;
  11. unsigned int esp0;
  12. unsigned int ss0;
  13. unsigned int esp1, ss1, esp2, ss2;
  14. unsigned int cr3;
  15. unsigned int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
  16. unsigned int es, cs, ss, ds, fs, gs;
  17. unsigned int ldt;
  18. unsigned short trap, iomap_base;
  19. } __attribute__((packed));
  20. /* Build/load the GDT and TSS for one CPU and point GS at cpus[cpu].
  21. * CPU 0 is initialized from kernel_main before paging; AP bring-up will
  22. * call the same function with its own index later. */
  23. void gdt_tss_init(unsigned int cpu);
  24. #endif