Debian Codegraph @

third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs

raw
1 use crate::prelude::*;
2
3 pub type clock_t = i32;
4 pub type wchar_t = i32;
5 pub type time_t = i64;
6 pub type suseconds_t = i64;
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 pub union __c_anonymous_elf64_auxv_union {
85 pub a_val: c_long,
86 pub a_ptr: *mut c_void,
87 pub a_fcn: extern "C" fn(),
88 }
89
90 pub struct Elf64_Auxinfo {
91 pub a_type: c_long,
92 pub a_un: __c_anonymous_elf64_auxv_union,
93 }
94
95 #[allow(missing_debug_implementations)]
96 #[repr(align(16))]
97 pub struct max_align_t {
98 priv_: [f64; 4],
99 }
100
101 #[repr(align(16))]
102 pub struct mcontext_t {
103 pub mc_onstack: register_t,
104 pub mc_rdi: register_t,
105 pub mc_rsi: register_t,
106 pub mc_rdx: register_t,
107 pub mc_rcx: register_t,
108 pub mc_r8: register_t,
109 pub mc_r9: register_t,
110 pub mc_rax: register_t,
111 pub mc_rbx: register_t,
112 pub mc_rbp: register_t,
113 pub mc_r10: register_t,
114 pub mc_r11: register_t,
115 pub mc_r12: register_t,
116 pub mc_r13: register_t,
117 pub mc_r14: register_t,
118 pub mc_r15: register_t,
119 pub mc_trapno: u32,
120 pub mc_fs: u16,
121 pub mc_gs: u16,
122 pub mc_addr: register_t,
123 pub mc_flags: u32,
124 pub mc_es: u16,
125 pub mc_ds: u16,
126 pub mc_err: register_t,
127 pub mc_rip: register_t,
128 pub mc_cs: register_t,
129 pub mc_rflags: register_t,
130 pub mc_rsp: register_t,
131 pub mc_ss: register_t,
132 pub mc_len: c_long,
133 pub mc_fpformat: c_long,
134 pub mc_ownedfp: c_long,
135 pub mc_fpstate: [c_long; 64],
136 pub mc_fsbase: register_t,
137 pub mc_gsbase: register_t,
138 pub mc_xfpustate: register_t,
139 pub mc_xfpustate_len: register_t,
140 pub mc_spare: [c_long; 4],
141 }
142 }
143
144 cfg_if! {
145 if #[cfg(feature = "extra_traits")] {
146 impl PartialEq for fpreg32 {
147 fn eq(&self, other: &fpreg32) -> bool {
148 self.fpr_env == other.fpr_env
149 && self.fpr_acc == other.fpr_acc
150 && self.fpr_ex_sw == other.fpr_ex_sw
151 && self
152 .fpr_pad
153 .iter()
154 .zip(other.fpr_pad.iter())
155 .all(|(a, b)| a == b)
156 }
157 }
158 impl Eq for fpreg32 {}
159 impl fmt::Debug for fpreg32 {
160 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
161 f.debug_struct("fpreg32")
162 .field("fpr_env", &&self.fpr_env[..])
163 .field("fpr_acc", &self.fpr_acc)
164 .field("fpr_ex_sw", &self.fpr_ex_sw)
165 .field("fpr_pad", &&self.fpr_pad[..])
166 .finish()
167 }
168 }
169 impl hash::Hash for fpreg32 {
170 fn hash<H: hash::Hasher>(&self, state: &mut H) {
171 self.fpr_env.hash(state);
172 self.fpr_acc.hash(state);
173 self.fpr_ex_sw.hash(state);
174 self.fpr_pad.hash(state);
175 }
176 }
177
178 impl PartialEq for fpreg {
179 fn eq(&self, other: &fpreg) -> bool {
180 self.fpr_env == other.fpr_env
181 && self.fpr_acc == other.fpr_acc
182 && self.fpr_xacc == other.fpr_xacc
183 && self.fpr_spare == other.fpr_spare
184 }
185 }
186 impl Eq for fpreg {}
187 impl fmt::Debug for fpreg {
188 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
189 f.debug_struct("fpreg")
190 .field("fpr_env", &self.fpr_env)
191 .field("fpr_acc", &self.fpr_acc)
192 .field("fpr_xacc", &self.fpr_xacc)
193 .field("fpr_spare", &self.fpr_spare)
194 .finish()
195 }
196 }
197 impl hash::Hash for fpreg {
198 fn hash<H: hash::Hasher>(&self, state: &mut H) {
199 self.fpr_env.hash(state);
200 self.fpr_acc.hash(state);
201 self.fpr_xacc.hash(state);
202 self.fpr_spare.hash(state);
203 }
204 }
205
206 impl PartialEq for xmmreg {
207 fn eq(&self, other: &xmmreg) -> bool {
208 self.xmm_env == other.xmm_env
209 && self.xmm_acc == other.xmm_acc
210 && self.xmm_reg == other.xmm_reg
211 && self
212 .xmm_pad
213 .iter()
214 .zip(other.xmm_pad.iter())
215 .all(|(a, b)| a == b)
216 }
217 }
218 impl Eq for xmmreg {}
219 impl fmt::Debug for xmmreg {
220 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
221 f.debug_struct("xmmreg")
222 .field("xmm_env", &self.xmm_env)
223 .field("xmm_acc", &self.xmm_acc)
224 .field("xmm_reg", &self.xmm_reg)
225 .field("xmm_pad", &&self.xmm_pad[..])
226 .finish()
227 }
228 }
229 impl hash::Hash for xmmreg {
230 fn hash<H: hash::Hasher>(&self, state: &mut H) {
231 self.xmm_env.hash(state);
232 self.xmm_acc.hash(state);
233 self.xmm_reg.hash(state);
234 self.xmm_pad.hash(state);
235 }
236 }
237
238 // FIXME(msrv): suggested method was added in 1.85
239 #[allow(unpredictable_function_pointer_comparisons)]
240 impl PartialEq for __c_anonymous_elf64_auxv_union {
241 fn eq(&self, other: &__c_anonymous_elf64_auxv_union) -> bool {
242 unsafe {
243 self.a_val == other.a_val
244 || self.a_ptr == other.a_ptr
245 || self.a_fcn == other.a_fcn
246 }
247 }
248 }
249 impl Eq for __c_anonymous_elf64_auxv_union {}
250 impl PartialEq for Elf64_Auxinfo {
251 fn eq(&self, other: &Elf64_Auxinfo) -> bool {
252 self.a_type == other.a_type && self.a_un == other.a_un
253 }
254 }
255 impl Eq for Elf64_Auxinfo {}
256 impl fmt::Debug for Elf64_Auxinfo {
257 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
258 f.debug_struct("Elf64_Auxinfo")
259 .field("a_type", &self.a_type)
260 .field("a_un", &self.a_un)
261 .finish()
262 }
263 }
264
265 impl PartialEq for mcontext_t {
266 fn eq(&self, other: &mcontext_t) -> bool {
267 self.mc_onstack == other.mc_onstack
268 && self.mc_rdi == other.mc_rdi
269 && self.mc_rsi == other.mc_rsi
270 && self.mc_rdx == other.mc_rdx
271 && self.mc_rcx == other.mc_rcx
272 && self.mc_r8 == other.mc_r8
273 && self.mc_r9 == other.mc_r9
274 && self.mc_rax == other.mc_rax
275 && self.mc_rbx == other.mc_rbx
276 && self.mc_rbp == other.mc_rbp
277 && self.mc_r10 == other.mc_r10
278 && self.mc_r11 == other.mc_r11
279 && self.mc_r12 == other.mc_r12
280 && self.mc_r13 == other.mc_r13
281 && self.mc_r14 == other.mc_r14
282 && self.mc_r15 == other.mc_r15
283 && self.mc_trapno == other.mc_trapno
284 && self.mc_fs == other.mc_fs
285 && self.mc_gs == other.mc_gs
286 && self.mc_addr == other.mc_addr
287 && self.mc_flags == other.mc_flags
288 && self.mc_es == other.mc_es
289 && self.mc_ds == other.mc_ds
290 && self.mc_err == other.mc_err
291 && self.mc_rip == other.mc_rip
292 && self.mc_cs == other.mc_cs
293 && self.mc_rflags == other.mc_rflags
294 && self.mc_rsp == other.mc_rsp
295 && self.mc_ss == other.mc_ss
296 && self.mc_len == other.mc_len
297 && self.mc_fpformat == other.mc_fpformat
298 && self.mc_ownedfp == other.mc_ownedfp
299 && self
300 .mc_fpstate
301 .iter()
302 .zip(other.mc_fpstate.iter())
303 .all(|(a, b)| a == b)
304 && self.mc_fsbase == other.mc_fsbase
305 && self.mc_gsbase == other.mc_gsbase
306 && self.mc_xfpustate == other.mc_xfpustate
307 && self.mc_xfpustate_len == other.mc_xfpustate_len
308 && self.mc_spare == other.mc_spare
309 }
310 }
311 impl Eq for mcontext_t {}
312 impl fmt::Debug for mcontext_t {
313 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
314 f.debug_struct("mcontext_t")
315 .field("mc_onstack", &self.mc_onstack)
316 .field("mc_rdi", &self.mc_rdi)
317 .field("mc_rsi", &self.mc_rsi)
318 .field("mc_rdx", &self.mc_rdx)
319 .field("mc_rcx", &self.mc_rcx)
320 .field("mc_r8", &self.mc_r8)
321 .field("mc_r9", &self.mc_r9)
322 .field("mc_rax", &self.mc_rax)
323 .field("mc_rbx", &self.mc_rbx)
324 .field("mc_rbp", &self.mc_rbp)
325 .field("mc_r10", &self.mc_r10)
326 .field("mc_r11", &self.mc_r11)
327 .field("mc_r12", &self.mc_r12)
328 .field("mc_r13", &self.mc_r13)
329 .field("mc_r14", &self.mc_r14)
330 .field("mc_r15", &self.mc_r15)
331 .field("mc_trapno", &self.mc_trapno)
332 .field("mc_fs", &self.mc_fs)
333 .field("mc_gs", &self.mc_gs)
334 .field("mc_addr", &self.mc_addr)
335 .field("mc_flags", &self.mc_flags)
336 .field("mc_es", &self.mc_es)
337 .field("mc_ds", &self.mc_ds)
338 .field("mc_err", &self.mc_err)
339 .field("mc_rip", &self.mc_rip)
340 .field("mc_cs", &self.mc_cs)
341 .field("mc_rflags", &self.mc_rflags)
342 .field("mc_rsp", &self.mc_rsp)
343 .field("mc_ss", &self.mc_ss)
344 .field("mc_len", &self.mc_len)
345 .field("mc_fpformat", &self.mc_fpformat)
346 .field("mc_ownedfp", &self.mc_ownedfp)
347 // FIXME(debug): .field("mc_fpstate", &self.mc_fpstate)
348 .field("mc_fsbase", &self.mc_fsbase)
349 .field("mc_gsbase", &self.mc_gsbase)
350 .field("mc_xfpustate", &self.mc_xfpustate)
351 .field("mc_xfpustate_len", &self.mc_xfpustate_len)
352 .field("mc_spare", &self.mc_spare)
353 .finish()
354 }
355 }
356 impl hash::Hash for mcontext_t {
357 fn hash<H: hash::Hasher>(&self, state: &mut H) {
358 self.mc_onstack.hash(state);
359 self.mc_rdi.hash(state);
360 self.mc_rsi.hash(state);
361 self.mc_rdx.hash(state);
362 self.mc_rcx.hash(state);
363 self.mc_r8.hash(state);
364 self.mc_r9.hash(state);
365 self.mc_rax.hash(state);
366 self.mc_rbx.hash(state);
367 self.mc_rbp.hash(state);
368 self.mc_r10.hash(state);
369 self.mc_r11.hash(state);
370 self.mc_r12.hash(state);
371 self.mc_r13.hash(state);
372 self.mc_r14.hash(state);
373 self.mc_r15.hash(state);
374 self.mc_trapno.hash(state);
375 self.mc_fs.hash(state);
376 self.mc_gs.hash(state);
377 self.mc_addr.hash(state);
378 self.mc_flags.hash(state);
379 self.mc_es.hash(state);
380 self.mc_ds.hash(state);
381 self.mc_err.hash(state);
382 self.mc_rip.hash(state);
383 self.mc_cs.hash(state);
384 self.mc_rflags.hash(state);
385 self.mc_rsp.hash(state);
386 self.mc_ss.hash(state);
387 self.mc_len.hash(state);
388 self.mc_fpformat.hash(state);
389 self.mc_ownedfp.hash(state);
390 self.mc_fpstate.hash(state);
391 self.mc_fsbase.hash(state);
392 self.mc_gsbase.hash(state);
393 self.mc_xfpustate.hash(state);
394 self.mc_xfpustate_len.hash(state);
395 self.mc_spare.hash(state);
396 }
397 }
398 }
399 }
400
401 pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_long>() - 1;
402
403 pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d;
404 pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e;
405
406 pub const MAP_32BIT: c_int = 0x00080000;
407 pub const MINSIGSTKSZ: size_t = 2048; // 512 * 4
408
409 pub const _MC_HASSEGS: u32 = 0x1;
410 pub const _MC_HASBASES: u32 = 0x2;
411 pub const _MC_HASFPXSTATE: u32 = 0x4;
412 pub const _MC_FLAG_MASK: u32 = _MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE;
413
414 pub const _MC_FPFMT_NODEV: c_long = 0x10000;
415 pub const _MC_FPFMT_XMM: c_long = 0x10002;
416 pub const _MC_FPOWNED_NONE: c_long = 0x20000;
417 pub const _MC_FPOWNED_FPU: c_long = 0x20001;
418 pub const _MC_FPOWNED_PCB: c_long = 0x20002;
419
420 pub const KINFO_FILE_SIZE: c_int = 1392;
421
422 pub const TIOCTIMESTAMP: c_ulong = 0x40107459;