|
47 | 47 | pub struct _libc_xmmreg {
|
48 | 48 | pub element: [u32; 4],
|
49 | 49 | }
|
| 50 | + |
| 51 | + pub struct user_regs_struct { |
| 52 | + pub r15: ::c_ulong, |
| 53 | + pub r14: ::c_ulong, |
| 54 | + pub r13: ::c_ulong, |
| 55 | + pub r12: ::c_ulong, |
| 56 | + pub rbp: ::c_ulong, |
| 57 | + pub rbx: ::c_ulong, |
| 58 | + pub r11: ::c_ulong, |
| 59 | + pub r10: ::c_ulong, |
| 60 | + pub r9: ::c_ulong, |
| 61 | + pub r8: ::c_ulong, |
| 62 | + pub rax: ::c_ulong, |
| 63 | + pub rcx: ::c_ulong, |
| 64 | + pub rdx: ::c_ulong, |
| 65 | + pub rsi: ::c_ulong, |
| 66 | + pub rdi: ::c_ulong, |
| 67 | + pub orig_rax: ::c_ulong, |
| 68 | + pub rip: ::c_ulong, |
| 69 | + pub cs: ::c_ulong, |
| 70 | + pub eflags: ::c_ulong, |
| 71 | + pub rsp: ::c_ulong, |
| 72 | + pub ss: ::c_ulong, |
| 73 | + pub fs_base: ::c_ulong, |
| 74 | + pub gs_base: ::c_ulong, |
| 75 | + pub ds: ::c_ulong, |
| 76 | + pub es: ::c_ulong, |
| 77 | + pub fs: ::c_ulong, |
| 78 | + pub gs: ::c_ulong, |
| 79 | + } |
| 80 | + |
| 81 | + pub struct user { |
| 82 | + pub regs: user_regs_struct, |
| 83 | + pub u_fpvalid: ::c_int, |
| 84 | + pub i387: user_fpregs_struct, |
| 85 | + pub u_tsize: ::c_ulong, |
| 86 | + pub u_dsize: ::c_ulong, |
| 87 | + pub u_ssize: ::c_ulong, |
| 88 | + pub start_code: ::c_ulong, |
| 89 | + pub start_stack: ::c_ulong, |
| 90 | + pub signal: ::c_long, |
| 91 | + __reserved: ::c_int, |
| 92 | + #[cfg(target_pointer_width = "32")] |
| 93 | + __pad1: u32, |
| 94 | + pub u_ar0: *mut user_regs_struct, |
| 95 | + #[cfg(target_pointer_width = "32")] |
| 96 | + __pad2: u32, |
| 97 | + pub u_fpstate: *mut user_fpregs_struct, |
| 98 | + pub magic: ::c_ulong, |
| 99 | + pub u_comm: [::c_char; 32], |
| 100 | + pub u_debugreg: [::c_ulong; 8], |
| 101 | + pub error_code: ::c_ulong, |
| 102 | + pub fault_address: ::c_ulong, |
| 103 | + } |
| 104 | + |
50 | 105 | }
|
51 | 106 |
|
52 | 107 | cfg_if! {
|
@@ -118,6 +173,20 @@ s_no_extra_traits! {
|
118 | 173 | pub uc_sigmask64: __c_anonymous_uc_sigmask,
|
119 | 174 | __fpregs_mem: _libc_fpstate,
|
120 | 175 | }
|
| 176 | + |
| 177 | + pub struct user_fpregs_struct { |
| 178 | + pub cwd: ::c_ushort, |
| 179 | + pub swd: ::c_ushort, |
| 180 | + pub ftw: ::c_ushort, |
| 181 | + pub fop: ::c_ushort, |
| 182 | + pub rip: ::c_ulong, |
| 183 | + pub rdp: ::c_ulong, |
| 184 | + pub mxcsr: ::c_uint, |
| 185 | + pub mxcr_mask: ::c_uint, |
| 186 | + pub st_space: [::c_uint; 32], |
| 187 | + pub xmm_space: [::c_uint; 64], |
| 188 | + padding: [::c_uint; 24], |
| 189 | + } |
121 | 190 | }
|
122 | 191 |
|
123 | 192 | cfg_if! {
|
@@ -254,6 +323,60 @@ cfg_if! {
|
254 | 323 | // Ignore padding field
|
255 | 324 | }
|
256 | 325 | }
|
| 326 | + |
| 327 | + impl PartialEq for user_fpregs_struct { |
| 328 | + fn eq(&self, other: &user_fpregs_struct) -> bool { |
| 329 | + self.cwd == other.cwd |
| 330 | + && self.swd == other.swd |
| 331 | + && self.ftw == other.ftw |
| 332 | + && self.fop == other.fop |
| 333 | + && self.rip == other.rip |
| 334 | + && self.rdp == other.rdp |
| 335 | + && self.mxcsr == other.mxcsr |
| 336 | + && self.mxcr_mask == other.mxcr_mask |
| 337 | + && self.st_space == other.st_space |
| 338 | + && self |
| 339 | + .xmm_space |
| 340 | + .iter() |
| 341 | + .zip(other.xmm_space.iter()) |
| 342 | + .all(|(a,b)| a == b) |
| 343 | + // Ignore padding field |
| 344 | + } |
| 345 | + } |
| 346 | + |
| 347 | + impl Eq for user_fpregs_struct {} |
| 348 | + |
| 349 | + impl ::fmt::Debug for user_fpregs_struct { |
| 350 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 351 | + f.debug_struct("user_fpregs_struct") |
| 352 | + .field("cwd", &self.cwd) |
| 353 | + .field("ftw", &self.ftw) |
| 354 | + .field("fop", &self.fop) |
| 355 | + .field("rip", &self.rip) |
| 356 | + .field("rdp", &self.rdp) |
| 357 | + .field("mxcsr", &self.mxcsr) |
| 358 | + .field("mxcr_mask", &self.mxcr_mask) |
| 359 | + .field("st_space", &self.st_space) |
| 360 | + // FIXME: .field("xmm_space", &self.xmm_space) |
| 361 | + // Ignore padding field |
| 362 | + .finish() |
| 363 | + } |
| 364 | + } |
| 365 | + |
| 366 | + impl ::hash::Hash for user_fpregs_struct { |
| 367 | + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 368 | + self.cwd.hash(state); |
| 369 | + self.ftw.hash(state); |
| 370 | + self.fop.hash(state); |
| 371 | + self.rip.hash(state); |
| 372 | + self.rdp.hash(state); |
| 373 | + self.mxcsr.hash(state); |
| 374 | + self.mxcr_mask.hash(state); |
| 375 | + self.st_space.hash(state); |
| 376 | + self.xmm_space.hash(state); |
| 377 | + // Ignore padding field |
| 378 | + } |
| 379 | + } |
257 | 380 | }
|
258 | 381 | }
|
259 | 382 |
|
|
0 commit comments