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