You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

registers.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef REGISTERS_H
  2. #define REGISTERS_H
  3. #include "stdint.h"
  4. /* Basic 16-bit and 32-bit register types */
  5. typedef union {
  6. struct {
  7. union {
  8. uint8_t l;
  9. uint8_t byte;
  10. };
  11. uint8_t h;
  12. } PACKED;
  13. uint16_t word;
  14. } PACKED reg16_t;
  15. typedef union {
  16. reg16_t;
  17. uint32_t dword;
  18. } PACKED reg32_t;
  19. /* As created by pushal / read by popal */
  20. struct i386_regs {
  21. union {
  22. uint16_t di;
  23. uint32_t edi;
  24. };
  25. union {
  26. uint16_t si;
  27. uint32_t esi;
  28. };
  29. union {
  30. uint16_t bp;
  31. uint32_t ebp;
  32. };
  33. union {
  34. uint16_t sp;
  35. uint32_t esp;
  36. };
  37. union {
  38. struct {
  39. uint8_t bl;
  40. uint8_t bh;
  41. } PACKED;
  42. uint16_t bx;
  43. uint32_t ebx;
  44. };
  45. union {
  46. struct {
  47. uint8_t dl;
  48. uint8_t dh;
  49. } PACKED;
  50. uint16_t dx;
  51. uint32_t edx;
  52. };
  53. union {
  54. struct {
  55. uint8_t cl;
  56. uint8_t ch;
  57. } PACKED;
  58. uint16_t cx;
  59. uint32_t ecx;
  60. };
  61. union {
  62. struct {
  63. uint8_t al;
  64. uint8_t ah;
  65. } PACKED;
  66. uint16_t ax;
  67. uint32_t eax;
  68. };
  69. } PACKED;
  70. /* Our pushal/popal equivalent for segment registers */
  71. struct i386_seg_regs {
  72. uint16_t cs;
  73. uint16_t ss;
  74. uint16_t ds;
  75. uint16_t es;
  76. uint16_t fs;
  77. uint16_t gs;
  78. } PACKED;
  79. /* All i386 registers, as passed in by prot_call or kir_call */
  80. struct i386_all_regs {
  81. struct i386_seg_regs;
  82. struct i386_regs;
  83. uint32_t i386_flags;
  84. } PACKED;
  85. #endif /* REGISTERS_H */