TSS.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Leon Albrecht <leon2002.la@gmail.com>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/Types.h>
  9. namespace Kernel {
  10. struct [[gnu::packed]] TSS32 {
  11. u16 backlink, __blh;
  12. u32 esp0;
  13. u16 ss0, __ss0h;
  14. u32 esp1;
  15. u16 ss1, __ss1h;
  16. u32 esp2;
  17. u16 ss2, __ss2h;
  18. u32 cr3, eip, eflags;
  19. u32 eax, ecx, edx, ebx, esp, ebp, esi, edi;
  20. u16 es, __esh;
  21. u16 cs, __csh;
  22. u16 ss, __ssh;
  23. u16 ds, __dsh;
  24. u16 fs, __fsh;
  25. u16 gs, __gsh;
  26. u16 ldt, __ldth;
  27. u16 trace, iomapbase;
  28. };
  29. struct [[gnu::packed]] TSS64 {
  30. u32 __1; // Link?
  31. u32 rsp0l;
  32. u32 rsp0h;
  33. u32 rsp1l;
  34. u32 rsp1h;
  35. u32 rsp2l;
  36. u32 rsp2h;
  37. u64 __2; //probably CR3 and EIP?
  38. u32 ist1l;
  39. u32 ist1h;
  40. u32 ist2l;
  41. u32 ist2h;
  42. u32 ist3l;
  43. u32 ist3h;
  44. u32 ist4l;
  45. u32 ist4h;
  46. u32 ist5l;
  47. u32 ist5h;
  48. u32 ist6l;
  49. u32 ist6h;
  50. u32 ist7l;
  51. u32 ist7h;
  52. u64 __3; // GS and LDTR?
  53. u16 __4;
  54. u16 iomapbase;
  55. };
  56. #if ARCH(I386)
  57. using TSS = TSS32;
  58. #elif ARCH(X86_64)
  59. using TSS = TSS64;
  60. #endif
  61. }