]>
Commit | Line | Data |
---|---|---|
532ac7d7 | 1 | pub type c_char = i8; |
476ff2be SL |
2 | pub type c_long = i64; |
3 | pub type c_ulong = u64; | |
3dfed10e | 4 | pub type wchar_t = i32; |
476ff2be SL |
5 | pub type time_t = i64; |
6 | pub type suseconds_t = i64; | |
3dfed10e XL |
7 | pub type register_t = i64; |
8 | ||
9 | s! { | |
10 | pub struct reg32 { | |
11 | pub r_fs: u32, | |
12 | pub r_es: u32, | |
13 | pub r_ds: u32, | |
14 | pub r_edi: u32, | |
15 | pub r_esi: u32, | |
16 | pub r_ebp: u32, | |
17 | pub r_isp: u32, | |
18 | pub r_ebx: u32, | |
19 | pub r_edx: u32, | |
20 | pub r_ecx: u32, | |
21 | pub r_eax: u32, | |
22 | pub r_trapno: u32, | |
23 | pub r_err: u32, | |
24 | pub r_eip: u32, | |
25 | pub r_cs: u32, | |
26 | pub r_eflags: u32, | |
27 | pub r_esp: u32, | |
28 | pub r_ss: u32, | |
29 | pub r_gs: u32, | |
30 | } | |
31 | ||
32 | pub struct reg { | |
33 | pub r_r15: i64, | |
34 | pub r_r14: i64, | |
35 | pub r_r13: i64, | |
36 | pub r_r12: i64, | |
37 | pub r_r11: i64, | |
38 | pub r_r10: i64, | |
39 | pub r_r9: i64, | |
40 | pub r_r8: i64, | |
41 | pub r_rdi: i64, | |
42 | pub r_rsi: i64, | |
43 | pub r_rbp: i64, | |
44 | pub r_rbx: i64, | |
45 | pub r_rdx: i64, | |
46 | pub r_rcx: i64, | |
47 | pub r_rax: i64, | |
48 | pub r_trapno: u32, | |
49 | pub r_fs: u16, | |
50 | pub r_gs: u16, | |
51 | pub r_err: u32, | |
52 | pub r_es: u16, | |
53 | pub r_ds: u16, | |
54 | pub r_rip: i64, | |
55 | pub r_cs: i64, | |
56 | pub r_rflags: i64, | |
57 | pub r_rsp: i64, | |
58 | pub r_ss: i64, | |
59 | } | |
60 | } | |
61 | ||
62 | s_no_extra_traits! { | |
63 | pub struct fpreg32 { | |
64 | pub fpr_env: [u32; 7], | |
65 | pub fpr_acc: [[u8; 10]; 8], | |
66 | pub fpr_ex_sw: u32, | |
67 | pub fpr_pad: [u8; 64], | |
68 | } | |
69 | ||
70 | pub struct fpreg { | |
71 | pub fpr_env: [u64; 4], | |
72 | pub fpr_acc: [[u8; 16]; 8], | |
73 | pub fpr_xacc: [[u8; 16]; 16], | |
74 | pub fpr_spare: [u64; 12], | |
75 | } | |
76 | ||
77 | pub struct xmmreg { | |
78 | pub xmm_env: [u32; 8], | |
79 | pub xmm_acc: [[u8; 16]; 8], | |
80 | pub xmm_reg: [[u8; 16]; 8], | |
81 | pub xmm_pad: [u8; 224], | |
82 | } | |
83 | } | |
84 | ||
85 | cfg_if! { | |
86 | if #[cfg(feature = "extra_traits")] { | |
87 | impl PartialEq for fpreg32 { | |
88 | fn eq(&self, other: &fpreg32) -> bool { | |
89 | self.fpr_env == other.fpr_env && | |
90 | self.fpr_acc == other.fpr_acc && | |
91 | self.fpr_ex_sw == other.fpr_ex_sw && | |
92 | self.fpr_pad | |
93 | .iter() | |
94 | .zip(other.fpr_pad.iter()) | |
95 | .all(|(a,b)| a == b) | |
96 | } | |
97 | } | |
98 | impl Eq for fpreg32 {} | |
99 | impl ::fmt::Debug for fpreg32 { | |
100 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
101 | f.debug_struct("fpreg32") | |
102 | .field("fpr_env", &&self.fpr_env[..]) | |
103 | .field("fpr_acc", &self.fpr_acc) | |
104 | .field("fpr_ex_sw", &self.fpr_ex_sw) | |
105 | .field("fpr_pad", &&self.fpr_pad[..]) | |
106 | .finish() | |
107 | } | |
108 | } | |
109 | impl ::hash::Hash for fpreg32 { | |
110 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
111 | self.fpr_env.hash(state); | |
112 | self.fpr_acc.hash(state); | |
113 | self.fpr_ex_sw.hash(state); | |
114 | self.fpr_pad.hash(state); | |
115 | } | |
116 | } | |
117 | ||
118 | impl PartialEq for fpreg { | |
119 | fn eq(&self, other: &fpreg) -> bool { | |
120 | self.fpr_env == other.fpr_env && | |
121 | self.fpr_acc == other.fpr_acc && | |
122 | self.fpr_xacc == other.fpr_xacc && | |
123 | self.fpr_spare == other.fpr_spare | |
124 | } | |
125 | } | |
126 | impl Eq for fpreg {} | |
127 | impl ::fmt::Debug for fpreg { | |
128 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
129 | f.debug_struct("fpreg") | |
130 | .field("fpr_env", &self.fpr_env) | |
131 | .field("fpr_acc", &self.fpr_acc) | |
132 | .field("fpr_xacc", &self.fpr_xacc) | |
133 | .field("fpr_spare", &self.fpr_spare) | |
134 | .finish() | |
135 | } | |
136 | } | |
137 | impl ::hash::Hash for fpreg { | |
138 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
139 | self.fpr_env.hash(state); | |
140 | self.fpr_acc.hash(state); | |
141 | self.fpr_xacc.hash(state); | |
142 | self.fpr_spare.hash(state); | |
143 | } | |
144 | } | |
145 | ||
146 | impl PartialEq for xmmreg { | |
147 | fn eq(&self, other: &xmmreg) -> bool { | |
148 | self.xmm_env == other.xmm_env && | |
149 | self.xmm_acc == other.xmm_acc && | |
150 | self.xmm_reg == other.xmm_reg && | |
151 | self.xmm_pad | |
152 | .iter() | |
153 | .zip(other.xmm_pad.iter()) | |
154 | .all(|(a,b)| a == b) | |
155 | } | |
156 | } | |
157 | impl Eq for xmmreg {} | |
158 | impl ::fmt::Debug for xmmreg { | |
159 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
160 | f.debug_struct("xmmreg") | |
161 | .field("xmm_env", &self.xmm_env) | |
162 | .field("xmm_acc", &self.xmm_acc) | |
163 | .field("xmm_reg", &self.xmm_reg) | |
164 | .field("xmm_pad", &&self.xmm_pad[..]) | |
165 | .finish() | |
166 | } | |
167 | } | |
168 | impl ::hash::Hash for xmmreg { | |
169 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
170 | self.xmm_env.hash(state); | |
171 | self.xmm_acc.hash(state); | |
172 | self.xmm_reg.hash(state); | |
173 | self.xmm_pad.hash(state); | |
174 | } | |
175 | } | |
176 | } | |
177 | } | |
476ff2be | 178 | |
532ac7d7 XL |
179 | // should be pub(crate), but that requires Rust 1.18.0 |
180 | cfg_if! { | |
181 | if #[cfg(libc_const_size_of)] { | |
182 | #[doc(hidden)] | |
183 | pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; | |
184 | } else { | |
185 | #[doc(hidden)] | |
186 | pub const _ALIGNBYTES: usize = 8 - 1; | |
187 | } | |
188 | } | |
ea8adc8c | 189 | pub const MAP_32BIT: ::c_int = 0x00080000; |
3dfed10e XL |
190 | pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 |
191 | ||
192 | pub const _MC_HASSEGS: u32 = 0x1; | |
193 | pub const _MC_HASBASES: u32 = 0x2; | |
194 | pub const _MC_HASFPXSTATE: u32 = 0x4; | |
195 | pub const _MC_FLAG_MASK: u32 = _MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE; | |
196 | ||
197 | pub const _MC_FPFMT_NODEV: c_long = 0x10000; | |
198 | pub const _MC_FPFMT_XMM: c_long = 0x10002; | |
199 | pub const _MC_FPOWNED_NONE: c_long = 0x20000; | |
200 | pub const _MC_FPOWNED_FPU: c_long = 0x20001; | |
201 | pub const _MC_FPOWNED_PCB: c_long = 0x20002; | |
e74abb32 XL |
202 | |
203 | cfg_if! { | |
204 | if #[cfg(libc_align)] { | |
205 | mod align; | |
206 | pub use self::align::*; | |
207 | } | |
208 | } |