tss.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright (C) 2021 Rain */
  2. /* This file is part of XNIX. */
  3. /*
  4. XNIX is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) and later version.
  8. */
  9. /*
  10. XNIX is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. */
  15. /*
  16. You should have received a copy of the GNU General Public License
  17. along with XNIX. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _TSS_H
  20. #define _TSS_H
  21. /* init/head.S */
  22. extern __uint64_t *gdt_table[];
  23. struct tss_entry {
  24. __uint64_t low;
  25. __uint64_t high;
  26. };
  27. extern void *stack_start;
  28. struct tss {
  29. __uint32_t rsvd0;
  30. __uint64_t rsp0;
  31. __uint64_t rsp1;
  32. __uint64_t rsp2;
  33. __uint64_t rsvd1;
  34. __uint64_t ist1, ist2, ist3, ist4;
  35. __uint64_t ist5, ist6, ist7;
  36. __uint64_t rsvd2;
  37. __uint16_t rsvd3;
  38. __uint16_t iomap_base;
  39. } __attribute__ ((packed));
  40. #define INIT_TSS { \
  41. .rsvd0 = 0, \
  42. .rsp0 = 0, \
  43. .rsp1 = 0, \
  44. .rsp2 = 0, \
  45. .rsvd1 = 0, \
  46. .ist1 = 0, \
  47. .ist2 = 0, \
  48. .ist3 = 0, \
  49. .ist4 = 0, \
  50. .ist5 = 0, \
  51. .ist6 = 0, \
  52. .ist7 = 0, \
  53. .rsvd2 = 0, \
  54. .rsvd3 = 0, \
  55. .iomap_base = 0 \
  56. }
  57. struct tss init_tss = INIT_TSS;
  58. #endif