Xen Test Framework
regs.h
Go to the documentation of this file.
1 #ifndef XTF_X86_REGS_H
2 #define XTF_X86_REGS_H
3 
4 #include <xtf/types.h>
5 
6 #if defined(__i386__)
7 
8 #define DECL_REG(n) \
9  union { uint32_t e ## n; unsigned long n; }
10 #define _DECL_REG(n) \
11  union { uint32_t _e ## n; unsigned long _ ## n; }
12 
13 struct cpu_regs {
14  DECL_REG(bp);
15  DECL_REG(bx);
16  DECL_REG(ax);
17  DECL_REG(cx);
18  DECL_REG(dx);
19  DECL_REG(si);
20  DECL_REG(di);
21 
22  uint16_t ds, :16;
23  uint16_t es, :16;
24 
25  uint32_t entry_vector;
26  uint32_t error_code;
27 
28 /* Hardware exception frame. */
29  DECL_REG(ip);
30  uint16_t cs, _pad1[1];
31  DECL_REG(flags);
32  _DECL_REG(sp); /* Won't be valid if stack */
33  uint16_t _ss, _pad0[1]; /* switch didn't occur. */
34 /* Top of stack. */
35 };
36 
37 #elif defined(__x86_64__)
38 
39 #define DECL_REG(n) \
40  union { uint64_t r ## n; uint32_t e ## n; unsigned long n; }
41 #define _DECL_REG(n) \
42  union { uint64_t _r ## n; uint32_t _e ## n; unsigned long _ ## n; }
43 
44 struct cpu_regs {
45  uint64_t r15;
46  uint64_t r14;
47  uint64_t r13;
48  uint64_t r12;
49  DECL_REG(bp);
50  DECL_REG(bx);
51  uint64_t r11;
52  uint64_t r10;
53  uint64_t r9;
54  uint64_t r8;
55  DECL_REG(ax);
56  DECL_REG(cx);
57  DECL_REG(dx);
58  DECL_REG(si);
59  DECL_REG(di);
60 
61  uint32_t error_code;
62  uint32_t entry_vector;
63 
64 /* Hardware exception frame. */
65  DECL_REG(ip);
66  uint16_t cs, _pad1[3];
67  DECL_REG(flags);
68  _DECL_REG(sp);
69  uint16_t _ss, _pad0[3];
70 /* Top of stack. */
71 };
72 
73 #endif /* __i386__ / __x86_64__ */
74 
75 #endif /* XTF_X86_REGS_H */
76 
77 /*
78  * Local variables:
79  * mode: C
80  * c-file-style: "BSD"
81  * c-basic-offset: 4
82  * tab-width: 4
83  * indent-tabs-mode: nil
84  * End:
85  */
Common declarations for all tests.
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
__UINT16_TYPE__ uint16_t
Definition: stdint.h:15