@@ -4,6 +4,176 @@ pub type c_ulong = u64;
4
4
pub type time_t = i64 ;
5
5
pub type suseconds_t = i64 ;
6
6
7
+ s ! {
8
+ pub struct reg32 {
9
+ pub r_fs: u32 ,
10
+ pub r_es: u32 ,
11
+ pub r_ds: u32 ,
12
+ pub r_edi: u32 ,
13
+ pub r_esi: u32 ,
14
+ pub r_ebp: u32 ,
15
+ pub r_isp: u32 ,
16
+ pub r_ebx: u32 ,
17
+ pub r_edx: u32 ,
18
+ pub r_ecx: u32 ,
19
+ pub r_eax: u32 ,
20
+ pub r_trapno: u32 ,
21
+ pub r_err: u32 ,
22
+ pub r_eip: u32 ,
23
+ pub r_cs: u32 ,
24
+ pub r_eflags: u32 ,
25
+ pub r_esp: u32 ,
26
+ pub r_ss: u32 ,
27
+ pub r_gs: u32 ,
28
+ }
29
+
30
+ pub struct reg {
31
+ pub r_r15: i64 ,
32
+ pub r_r14: i64 ,
33
+ pub r_r13: i64 ,
34
+ pub r_r12: i64 ,
35
+ pub r_r11: i64 ,
36
+ pub r_r10: i64 ,
37
+ pub r_r9: i64 ,
38
+ pub r_r8: i64 ,
39
+ pub r_rdi: i64 ,
40
+ pub r_rsi: i64 ,
41
+ pub r_rbp: i64 ,
42
+ pub r_rbx: i64 ,
43
+ pub r_rdx: i64 ,
44
+ pub r_rcx: i64 ,
45
+ pub r_rax: i64 ,
46
+ pub r_trapno: u32 ,
47
+ pub r_fs: u16 ,
48
+ pub r_gs: u16 ,
49
+ pub r_err: u32 ,
50
+ pub r_es: u16 ,
51
+ pub r_ds: u16 ,
52
+ pub r_rip: i64 ,
53
+ pub r_cs: i64 ,
54
+ pub r_rflags: i64 ,
55
+ pub r_rsp: i64 ,
56
+ pub r_ss: i64 ,
57
+ }
58
+ }
59
+
60
+ s_no_extra_traits ! {
61
+ pub struct fpreg32 {
62
+ pub fpr_env: [ u32 ; 7 ] ,
63
+ pub fpr_acc: [ [ u8 ; 10 ] ; 8 ] ,
64
+ pub fpr_ex_sw: u32 ,
65
+ pub fpr_pad: [ u8 ; 64 ] ,
66
+ }
67
+
68
+ pub struct fpreg {
69
+ pub fpr_env: [ u64 ; 4 ] ,
70
+ pub fpr_acc: [ [ u8 ; 16 ] ; 8 ] ,
71
+ pub fpr_xacc: [ [ u8 ; 16 ] ; 16 ] ,
72
+ pub fpr_spare: [ u64 ; 12 ] ,
73
+ }
74
+
75
+ pub struct xmmreg {
76
+ pub xmm_env: [ u32 ; 8 ] ,
77
+ pub xmm_acc: [ [ u8 ; 16 ] ; 8 ] ,
78
+ pub xmm_reg: [ [ u8 ; 16 ] ; 8 ] ,
79
+ pub xmm_pad: [ u8 ; 224 ] ,
80
+ }
81
+ }
82
+
83
+ cfg_if ! {
84
+ if #[ cfg( feature = "extra_traits" ) ] {
85
+ impl PartialEq for fpreg32 {
86
+ fn eq( & self , other: & fpreg32) -> bool {
87
+ self . fpr_env == other. fpr_env &&
88
+ self . fpr_acc == other. fpr_acc &&
89
+ self . fpr_ex_sw == other. fpr_ex_sw &&
90
+ self . fpr_pad
91
+ . iter( )
92
+ . zip( other. fpr_pad. iter( ) )
93
+ . all( |( a, b) | a == b)
94
+ }
95
+ }
96
+ impl Eq for fpreg32 { }
97
+ impl :: fmt:: Debug for fpreg32 {
98
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
99
+ f. debug_struct( "fpreg32" )
100
+ . field( "fpr_env" , &&self . fpr_env[ ..] )
101
+ . field( "fpr_acc" , & self . fpr_acc)
102
+ . field( "fpr_ex_sw" , & self . fpr_ex_sw)
103
+ . field( "fpr_pad" , &&self . fpr_pad[ ..] )
104
+ . finish( )
105
+ }
106
+ }
107
+ impl :: hash:: Hash for fpreg32 {
108
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
109
+ self . fpr_env. hash( state) ;
110
+ self . fpr_acc. hash( state) ;
111
+ self . fpr_ex_sw. hash( state) ;
112
+ self . fpr_pad. hash( state) ;
113
+ }
114
+ }
115
+
116
+ impl PartialEq for fpreg {
117
+ fn eq( & self , other: & fpreg) -> bool {
118
+ self . fpr_env == other. fpr_env &&
119
+ self . fpr_acc == other. fpr_acc &&
120
+ self . fpr_xacc == other. fpr_xacc &&
121
+ self . fpr_spare == other. fpr_spare
122
+ }
123
+ }
124
+ impl Eq for fpreg { }
125
+ impl :: fmt:: Debug for fpreg {
126
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
127
+ f. debug_struct( "fpreg" )
128
+ . field( "fpr_env" , & self . fpr_env)
129
+ . field( "fpr_acc" , & self . fpr_acc)
130
+ . field( "fpr_xacc" , & self . fpr_xacc)
131
+ . field( "fpr_spare" , & self . fpr_spare)
132
+ . finish( )
133
+ }
134
+ }
135
+ impl :: hash:: Hash for fpreg {
136
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
137
+ self . fpr_env. hash( state) ;
138
+ self . fpr_acc. hash( state) ;
139
+ self . fpr_xacc. hash( state) ;
140
+ self . fpr_spare. hash( state) ;
141
+ }
142
+ }
143
+
144
+ impl PartialEq for xmmreg {
145
+ fn eq( & self , other: & xmmreg) -> bool {
146
+ self . xmm_env == other. xmm_env &&
147
+ self . xmm_acc == other. xmm_acc &&
148
+ self . xmm_reg == other. xmm_reg &&
149
+ self . xmm_pad
150
+ . iter( )
151
+ . zip( other. xmm_pad. iter( ) )
152
+ . all( |( a, b) | a == b)
153
+ }
154
+ }
155
+ impl Eq for xmmreg { }
156
+ impl :: fmt:: Debug for xmmreg {
157
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
158
+ f. debug_struct( "xmmreg" )
159
+ . field( "xmm_env" , & self . xmm_env)
160
+ . field( "xmm_acc" , & self . xmm_acc)
161
+ . field( "xmm_reg" , & self . xmm_reg)
162
+ . field( "xmm_pad" , &&self . xmm_pad[ ..] )
163
+ . finish( )
164
+ }
165
+ }
166
+ impl :: hash:: Hash for xmmreg {
167
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
168
+ self . xmm_env. hash( state) ;
169
+ self . xmm_acc. hash( state) ;
170
+ self . xmm_reg. hash( state) ;
171
+ self . xmm_pad. hash( state) ;
172
+ }
173
+ }
174
+ }
175
+ }
176
+
7
177
// should be pub(crate), but that requires Rust 1.18.0
8
178
cfg_if ! {
9
179
if #[ cfg( libc_const_size_of) ] {
0 commit comments