libc/unix/bsd/freebsdlike/freebsd/x86_64/
mod.rs

1use crate::prelude::*;
2
3pub type clock_t = i32;
4pub type wchar_t = i32;
5pub type time_t = i64;
6pub type suseconds_t = i64;
7pub type register_t = i64;
8
9s! {
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    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    #[repr(align(16))]
82    #[cfg_attr(not(any(freebsd11, freebsd12, freebsd13, freebsd14)), non_exhaustive)]
83    pub struct mcontext_t {
84        pub mc_onstack: register_t,
85        pub mc_rdi: register_t,
86        pub mc_rsi: register_t,
87        pub mc_rdx: register_t,
88        pub mc_rcx: register_t,
89        pub mc_r8: register_t,
90        pub mc_r9: register_t,
91        pub mc_rax: register_t,
92        pub mc_rbx: register_t,
93        pub mc_rbp: register_t,
94        pub mc_r10: register_t,
95        pub mc_r11: register_t,
96        pub mc_r12: register_t,
97        pub mc_r13: register_t,
98        pub mc_r14: register_t,
99        pub mc_r15: register_t,
100        pub mc_trapno: u32,
101        pub mc_fs: u16,
102        pub mc_gs: u16,
103        pub mc_addr: register_t,
104        pub mc_flags: u32,
105        pub mc_es: u16,
106        pub mc_ds: u16,
107        pub mc_err: register_t,
108        pub mc_rip: register_t,
109        pub mc_cs: register_t,
110        pub mc_rflags: register_t,
111        pub mc_rsp: register_t,
112        pub mc_ss: register_t,
113        pub mc_len: c_long,
114        pub mc_fpformat: c_long,
115        pub mc_ownedfp: c_long,
116        pub mc_fpstate: [c_long; 64],
117        pub mc_fsbase: register_t,
118        pub mc_gsbase: register_t,
119        pub mc_xfpustate: register_t,
120        pub mc_xfpustate_len: register_t,
121        // freebsd < 15
122        #[cfg(any(freebsd11, freebsd12, freebsd13, freebsd14))]
123        pub mc_spare: [c_long; 4],
124        // freebsd >= 15
125        #[cfg(not(any(freebsd11, freebsd12, freebsd13, freebsd14)))]
126        pub mc_tlsbase: register_t,
127        #[cfg(not(any(freebsd11, freebsd12, freebsd13, freebsd14)))]
128        pub mc_spare: [c_long; 3],
129    }
130}
131
132s_no_extra_traits! {
133    pub union __c_anonymous_elf64_auxv_union {
134        pub a_val: c_long,
135        pub a_ptr: *mut c_void,
136        pub a_fcn: extern "C" fn(),
137    }
138
139    pub struct Elf64_Auxinfo {
140        pub a_type: c_long,
141        pub a_un: __c_anonymous_elf64_auxv_union,
142    }
143
144    #[repr(align(16))]
145    pub struct max_align_t {
146        priv_: [f64; 4],
147    }
148}
149
150cfg_if! {
151    if #[cfg(feature = "extra_traits")] {
152        // FIXME(msrv): suggested method was added in 1.85
153        #[allow(unpredictable_function_pointer_comparisons)]
154        impl PartialEq for __c_anonymous_elf64_auxv_union {
155            fn eq(&self, other: &__c_anonymous_elf64_auxv_union) -> bool {
156                unsafe {
157                    self.a_val == other.a_val
158                        || self.a_ptr == other.a_ptr
159                        || self.a_fcn == other.a_fcn
160                }
161            }
162        }
163        impl Eq for __c_anonymous_elf64_auxv_union {}
164    }
165}
166
167pub(crate) const _ALIGNBYTES: usize = size_of::<c_long>() - 1;
168
169pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d;
170pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e;
171
172pub const MAP_32BIT: c_int = 0x00080000;
173pub const MINSIGSTKSZ: size_t = 2048; // 512 * 4
174
175pub const _MC_HASSEGS: u32 = 0x1;
176pub const _MC_HASBASES: u32 = 0x2;
177pub const _MC_HASFPXSTATE: u32 = 0x4;
178
179pub const _MC_FPFMT_NODEV: c_long = 0x10000;
180pub const _MC_FPFMT_XMM: c_long = 0x10002;
181pub const _MC_FPOWNED_NONE: c_long = 0x20000;
182pub const _MC_FPOWNED_FPU: c_long = 0x20001;
183pub const _MC_FPOWNED_PCB: c_long = 0x20002;
184
185pub const KINFO_FILE_SIZE: c_int = 1392;
186
187pub const TIOCTIMESTAMP: c_ulong = 0x40107459;