Advertisement
Guest User

Untitled

a guest
Sep 4th, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. tss.h:
  2. #ifndef TSS_H
  3. #define TSS_H
  4.  
  5. #include <types.h>
  6.  
  7. struct tss_type {
  8. uint32_t reserved1;
  9. uint32_t rsp0_low;
  10. uint32_t rsp0_high;
  11. uint32_t rsp1_low;
  12. uint32_t rsp1_high;
  13. uint32_t rsp2_low;
  14. uint32_t rsp2_high;
  15. uint32_t reserved2;
  16. uint32_t reserved3;
  17. uint32_t ist1_low;
  18. uint32_t ist1_high;
  19. uint32_t ist2_low;
  20. uint32_t ist2_high;
  21. uint32_t ist3_low;
  22. uint32_t ist3_high;
  23. uint32_t ist4_low;
  24. uint32_t ist4_high;
  25. uint32_t ist5_low;
  26. uint32_t ist5_high;
  27. uint32_t ist6_low;
  28. uint32_t ist6_high;
  29. uint32_t ist7_low;
  30. uint32_t ist7_high;
  31. uint32_t reserved4;
  32. uint32_t reserved5;
  33. uint16_t reserved6;
  34. uint16_t iopb;
  35. } __attribute__((packed, aligned(4096)));
  36. typedef struct tss_type tss_type;
  37.  
  38. extern tss_type tss;
  39.  
  40. void load_tss(void);
  41. void init_tss(void);
  42.  
  43. #endif
  44.  
  45.  
  46. tss.c:
  47. #include <tss.h>
  48.  
  49. tss_type tss;
  50.  
  51. void load_tss()
  52. {
  53. __asm__ volatile ("mov $0x28, %ax; ltr %ax;");
  54. }
  55.  
  56. void init_tss()
  57. {
  58. tss.iopb = sizeof(tss_type);
  59.  
  60. load_tss();
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement