1 //===-- MachRegisterStatesX86_64.h --------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  Created by Sean Callanan on 3/16/11.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef __MachRegisterStatesX86_64_h__
15 #define __MachRegisterStatesX86_64_h__
16 
17 #include <inttypes.h>
18 
19 #define __x86_64_THREAD_STATE       4
20 #define __x86_64_FLOAT_STATE        5
21 #define __x86_64_EXCEPTION_STATE    6
22 #define __x86_64_DEBUG_STATE        11
23 #define __x86_64_AVX_STATE          17
24 
25 typedef struct {
26     uint64_t    __rax;
27     uint64_t    __rbx;
28     uint64_t    __rcx;
29     uint64_t    __rdx;
30     uint64_t    __rdi;
31     uint64_t    __rsi;
32     uint64_t    __rbp;
33     uint64_t    __rsp;
34     uint64_t    __r8;
35     uint64_t    __r9;
36     uint64_t    __r10;
37     uint64_t    __r11;
38     uint64_t    __r12;
39     uint64_t    __r13;
40     uint64_t    __r14;
41     uint64_t    __r15;
42     uint64_t    __rip;
43     uint64_t    __rflags;
44     uint64_t    __cs;
45     uint64_t    __fs;
46     uint64_t    __gs;
47 } __x86_64_thread_state_t;
48 
49 typedef struct {
50     uint16_t    __invalid   : 1;
51     uint16_t    __denorm    : 1;
52     uint16_t    __zdiv      : 1;
53     uint16_t    __ovrfl     : 1;
54     uint16_t    __undfl     : 1;
55     uint16_t    __precis    : 1;
56     uint16_t    __PAD1      : 2;
57     uint16_t    __pc        : 2;
58     uint16_t    __rc        : 2;
59     uint16_t    __PAD2      : 1;
60     uint16_t    __PAD3      : 3;
61 } __x86_64_fp_control_t;
62 
63 typedef struct {
64     uint16_t    __invalid   : 1;
65     uint16_t    __denorm    : 1;
66     uint16_t    __zdiv      : 1;
67     uint16_t    __ovrfl     : 1;
68     uint16_t    __undfl     : 1;
69     uint16_t    __precis    : 1;
70     uint16_t    __stkflt    : 1;
71     uint16_t    __errsumm   : 1;
72     uint16_t    __c0        : 1;
73     uint16_t    __c1        : 1;
74     uint16_t    __c2        : 1;
75     uint16_t    __tos       : 3;
76     uint16_t    __c3        : 1;
77     uint16_t    __busy      : 1;
78 } __x86_64_fp_status_t;
79 
80 typedef struct {
81     uint8_t     __mmst_reg[10];
82     uint8_t     __mmst_rsrv[6];
83 } __x86_64_mmst_reg;
84 
85 typedef struct {
86     uint8_t     __xmm_reg[16];
87 } __x86_64_xmm_reg;
88 
89 typedef struct {
90     int32_t                 __fpu_reserved[2];
91     __x86_64_fp_control_t   __fpu_fcw;
92     __x86_64_fp_status_t    __fpu_fsw;
93     uint8_t                 __fpu_ftw;
94     uint8_t                 __fpu_rsrv1;
95     uint16_t                __fpu_fop;
96     uint32_t                __fpu_ip;
97     uint16_t                __fpu_cs;
98     uint16_t                __fpu_rsrv2;
99     uint32_t                __fpu_dp;
100     uint16_t                __fpu_ds;
101     uint16_t                __fpu_rsrv3;
102     uint32_t                __fpu_mxcsr;
103     uint32_t                __fpu_mxcsrmask;
104     __x86_64_mmst_reg       __fpu_stmm0;
105     __x86_64_mmst_reg       __fpu_stmm1;
106     __x86_64_mmst_reg       __fpu_stmm2;
107     __x86_64_mmst_reg       __fpu_stmm3;
108     __x86_64_mmst_reg       __fpu_stmm4;
109     __x86_64_mmst_reg       __fpu_stmm5;
110     __x86_64_mmst_reg       __fpu_stmm6;
111     __x86_64_mmst_reg       __fpu_stmm7;
112     __x86_64_xmm_reg        __fpu_xmm0;
113     __x86_64_xmm_reg        __fpu_xmm1;
114     __x86_64_xmm_reg        __fpu_xmm2;
115     __x86_64_xmm_reg        __fpu_xmm3;
116     __x86_64_xmm_reg        __fpu_xmm4;
117     __x86_64_xmm_reg        __fpu_xmm5;
118     __x86_64_xmm_reg        __fpu_xmm6;
119     __x86_64_xmm_reg        __fpu_xmm7;
120     __x86_64_xmm_reg        __fpu_xmm8;
121     __x86_64_xmm_reg        __fpu_xmm9;
122     __x86_64_xmm_reg        __fpu_xmm10;
123     __x86_64_xmm_reg        __fpu_xmm11;
124     __x86_64_xmm_reg        __fpu_xmm12;
125     __x86_64_xmm_reg        __fpu_xmm13;
126     __x86_64_xmm_reg        __fpu_xmm14;
127     __x86_64_xmm_reg        __fpu_xmm15;
128     uint8_t                 __fpu_rsrv4[6*16];
129     int32_t                 __fpu_reserved1;
130 } __x86_64_float_state_t;
131 
132 typedef struct {
133     uint32_t                __fpu_reserved[2];
134     __x86_64_fp_control_t   __fpu_fcw;
135     __x86_64_fp_status_t    __fpu_fsw;
136     uint8_t                 __fpu_ftw;
137     uint8_t                 __fpu_rsrv1;
138     uint16_t                __fpu_fop;
139     uint32_t                __fpu_ip;
140     uint16_t                __fpu_cs;
141     uint16_t                __fpu_rsrv2;
142     uint32_t                __fpu_dp;
143     uint16_t                __fpu_ds;
144     uint16_t                __fpu_rsrv3;
145     uint32_t                __fpu_mxcsr;
146     uint32_t                __fpu_mxcsrmask;
147     __x86_64_mmst_reg       __fpu_stmm0;
148     __x86_64_mmst_reg       __fpu_stmm1;
149     __x86_64_mmst_reg       __fpu_stmm2;
150     __x86_64_mmst_reg       __fpu_stmm3;
151     __x86_64_mmst_reg       __fpu_stmm4;
152     __x86_64_mmst_reg       __fpu_stmm5;
153     __x86_64_mmst_reg       __fpu_stmm6;
154     __x86_64_mmst_reg       __fpu_stmm7;
155     __x86_64_xmm_reg        __fpu_xmm0;
156     __x86_64_xmm_reg        __fpu_xmm1;
157     __x86_64_xmm_reg        __fpu_xmm2;
158     __x86_64_xmm_reg        __fpu_xmm3;
159     __x86_64_xmm_reg        __fpu_xmm4;
160     __x86_64_xmm_reg        __fpu_xmm5;
161     __x86_64_xmm_reg        __fpu_xmm6;
162     __x86_64_xmm_reg        __fpu_xmm7;
163     __x86_64_xmm_reg        __fpu_xmm8;
164     __x86_64_xmm_reg        __fpu_xmm9;
165     __x86_64_xmm_reg        __fpu_xmm10;
166     __x86_64_xmm_reg        __fpu_xmm11;
167     __x86_64_xmm_reg        __fpu_xmm12;
168     __x86_64_xmm_reg        __fpu_xmm13;
169     __x86_64_xmm_reg        __fpu_xmm14;
170     __x86_64_xmm_reg        __fpu_xmm15;
171     uint8_t                 __fpu_rsrv4[6*16];
172     uint32_t                __fpu_reserved1;
173     uint8_t                 __avx_reserved1[64];
174     __x86_64_xmm_reg        __fpu_ymmh0;
175     __x86_64_xmm_reg        __fpu_ymmh1;
176     __x86_64_xmm_reg        __fpu_ymmh2;
177     __x86_64_xmm_reg        __fpu_ymmh3;
178     __x86_64_xmm_reg        __fpu_ymmh4;
179     __x86_64_xmm_reg        __fpu_ymmh5;
180     __x86_64_xmm_reg        __fpu_ymmh6;
181     __x86_64_xmm_reg        __fpu_ymmh7;
182     __x86_64_xmm_reg        __fpu_ymmh8;
183     __x86_64_xmm_reg        __fpu_ymmh9;
184     __x86_64_xmm_reg        __fpu_ymmh10;
185     __x86_64_xmm_reg        __fpu_ymmh11;
186     __x86_64_xmm_reg        __fpu_ymmh12;
187     __x86_64_xmm_reg        __fpu_ymmh13;
188     __x86_64_xmm_reg        __fpu_ymmh14;
189     __x86_64_xmm_reg        __fpu_ymmh15;
190 } __x86_64_avx_state_t;
191 
192 typedef struct {
193     uint32_t    __trapno;
194     uint32_t    __err;
195     uint64_t    __faultvaddr;
196 } __x86_64_exception_state_t;
197 
198 
199 typedef struct {
200 	uint64_t	__dr0;
201 	uint64_t	__dr1;
202 	uint64_t	__dr2;
203 	uint64_t	__dr3;
204 	uint64_t	__dr4;
205 	uint64_t	__dr5;
206 	uint64_t	__dr6;
207 	uint64_t	__dr7;
208 } __x86_64_debug_state_t;
209 
210 #endif
211