1 pub type greg_t = ::c_long;
2 
3 pub type Elf64_Addr = ::c_ulong;
4 pub type Elf64_Half = ::c_ushort;
5 pub type Elf64_Off = ::c_ulong;
6 pub type Elf64_Sword = ::c_int;
7 pub type Elf64_Sxword = ::c_long;
8 pub type Elf64_Word = ::c_uint;
9 pub type Elf64_Xword = ::c_ulong;
10 pub type Elf64_Lword = ::c_ulong;
11 pub type Elf64_Phdr = __c_anonymous_Elf64_Phdr;
12 
13 s! {
14     pub struct __c_anonymous_fpchip_state {
15         pub cw: u16,
16         pub sw: u16,
17         pub fctw: u8,
18         pub __fx_rsvd: u8,
19         pub fop: u16,
20         pub rip: u64,
21         pub rdp: u64,
22         pub mxcsr: u32,
23         pub mxcsr_mask: u32,
24         pub st: [::upad128_t; 8],
25         pub xmm: [::upad128_t; 16],
26         pub __fx_ign: [::upad128_t; 6],
27         pub status: u32,
28         pub xstatus: u32,
29     }
30 
31     pub struct __c_anonymous_Elf64_Phdr {
32         pub p_type: ::Elf64_Word,
33         pub p_flags: ::Elf64_Word,
34         pub p_offset: ::Elf64_Off,
35         pub p_vaddr: ::Elf64_Addr,
36         pub p_paddr: ::Elf64_Addr,
37         pub p_filesz: ::Elf64_Xword,
38         pub p_memsz: ::Elf64_Xword,
39         pub p_align: ::Elf64_Xword,
40     }
41 
42     pub struct dl_phdr_info {
43         pub dlpi_addr: ::Elf64_Addr,
44         pub dlpi_name: *const ::c_char,
45         pub dlpi_phdr: *const ::Elf64_Phdr,
46         pub dlpi_phnum: ::Elf64_Half,
47         pub dlpi_adds: ::c_ulonglong,
48         pub dlpi_subs: ::c_ulonglong,
49     }
50 }
51 
52 s_no_extra_traits! {
53     #[cfg(libc_union)]
54     pub union __c_anonymous_fp_reg_set {
55         pub fpchip_state: __c_anonymous_fpchip_state,
56         pub f_fpregs: [[u32; 13]; 10],
57     }
58 
59     pub struct fpregset_t {
60         pub fp_reg_set: __c_anonymous_fp_reg_set,
61     }
62 
63     pub struct mcontext_t {
64         pub gregs: [::greg_t; 28],
65         pub fpregs: fpregset_t,
66     }
67 
68     pub struct ucontext_t {
69         pub uc_flags: ::c_ulong,
70         pub uc_link: *mut ucontext_t,
71         pub uc_sigmask: ::sigset_t,
72         pub uc_stack: ::stack_t,
73         pub uc_mcontext: mcontext_t,
74         pub uc_filler: [::c_long; 5],
75     }
76 }
77 
78 cfg_if! {
79     if #[cfg(feature = "extra_traits")] {
80         #[cfg(libc_union)]
81         impl PartialEq for __c_anonymous_fp_reg_set {
82             fn eq(&self, other: &__c_anonymous_fp_reg_set) -> bool {
83                 unsafe {
84                 self.fpchip_state == other.fpchip_state ||
85                     self.
86                     f_fpregs.
87                     iter().
88                     zip(other.f_fpregs.iter()).
89                     all(|(a, b)| a == b)
90                 }
91             }
92         }
93         #[cfg(libc_union)]
94         impl Eq for __c_anonymous_fp_reg_set {}
95         #[cfg(libc_union)]
96         impl ::fmt::Debug for __c_anonymous_fp_reg_set {
97             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
98                 unsafe {
99                 f.debug_struct("__c_anonymous_fp_reg_set")
100                     .field("fpchip_state", &{self.fpchip_state})
101                     .field("f_fpregs", &{self.f_fpregs})
102                     .finish()
103                 }
104             }
105         }
106         impl PartialEq for fpregset_t {
107             fn eq(&self, other: &fpregset_t) -> bool {
108                 self.fp_reg_set == other.fp_reg_set
109             }
110         }
111         impl Eq for fpregset_t {}
112         impl ::fmt::Debug for fpregset_t {
113             fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result {
114                 f.debug_struct("fpregset_t")
115                     .field("fp_reg_set", &self.fp_reg_set)
116                     .finish()
117             }
118         }
119         impl PartialEq for mcontext_t {
120             fn eq(&self, other: &mcontext_t) -> bool {
121                 self.gregs == other.gregs &&
122                     self.fpregs == other.fpregs
123             }
124         }
125         impl Eq for mcontext_t {}
126         impl ::fmt::Debug for mcontext_t {
127             fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result {
128                 f.debug_struct("mcontext_t")
129                     .field("gregs", &self.gregs)
130                     .field("fpregs", &self.fpregs)
131                     .finish()
132             }
133         }
134         impl PartialEq for ucontext_t {
135             fn eq(&self, other: &ucontext_t) -> bool {
136                 self.uc_flags == other.uc_flags
137                     && self.uc_link == other.uc_link
138                     && self.uc_sigmask == other.uc_sigmask
139                     && self.uc_stack == other.uc_stack
140                     && self.uc_mcontext == other.uc_mcontext
141                     && self.uc_filler == other.uc_filler
142             }
143         }
144         impl Eq for ucontext_t {}
145         impl ::fmt::Debug for ucontext_t {
146             fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result {
147                 f.debug_struct("ucontext_t")
148                     .field("uc_flags", &self.uc_flags)
149                     .field("uc_link", &self.uc_link)
150                     .field("uc_sigmask", &self.uc_sigmask)
151                     .field("uc_stack", &self.uc_stack)
152                     .field("uc_mcontext", &self.uc_mcontext)
153                     .field("uc_filler", &self.uc_filler)
154                     .finish()
155             }
156         }
157 
158     }
159 }
160 
161 // sys/regset.h
162 
163 pub const REG_GSBASE: ::c_int = 27;
164 pub const REG_FSBASE: ::c_int = 26;
165 pub const REG_DS: ::c_int = 25;
166 pub const REG_ES: ::c_int = 24;
167 pub const REG_GS: ::c_int = 23;
168 pub const REG_FS: ::c_int = 22;
169 pub const REG_SS: ::c_int = 21;
170 pub const REG_RSP: ::c_int = 20;
171 pub const REG_RFL: ::c_int = 19;
172 pub const REG_CS: ::c_int = 18;
173 pub const REG_RIP: ::c_int = 17;
174 pub const REG_ERR: ::c_int = 16;
175 pub const REG_TRAPNO: ::c_int = 15;
176 pub const REG_RAX: ::c_int = 14;
177 pub const REG_RCX: ::c_int = 13;
178 pub const REG_RDX: ::c_int = 12;
179 pub const REG_RBX: ::c_int = 11;
180 pub const REG_RBP: ::c_int = 10;
181 pub const REG_RSI: ::c_int = 9;
182 pub const REG_RDI: ::c_int = 8;
183 pub const REG_R8: ::c_int = 7;
184 pub const REG_R9: ::c_int = 6;
185 pub const REG_R10: ::c_int = 5;
186 pub const REG_R11: ::c_int = 4;
187 pub const REG_R12: ::c_int = 3;
188 pub const REG_R13: ::c_int = 2;
189 pub const REG_R14: ::c_int = 1;
190 pub const REG_R15: ::c_int = 0;
191