Debian Codegraph @

third_party/rust/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs

raw
1 use crate::prelude::*;
2 use crate::PT_FIRSTMACH;
3
4 pub type ucontext_t = sigcontext;
5
6 s! {
7 pub struct sigcontext {
8 pub sc_rdi: c_long,
9 pub sc_rsi: c_long,
10 pub sc_rdx: c_long,
11 pub sc_rcx: c_long,
12 pub sc_r8: c_long,
13 pub sc_r9: c_long,
14 pub sc_r10: c_long,
15 pub sc_r11: c_long,
16 pub sc_r12: c_long,
17 pub sc_r13: c_long,
18 pub sc_r14: c_long,
19 pub sc_r15: c_long,
20 pub sc_rbp: c_long,
21 pub sc_rbx: c_long,
22 pub sc_rax: c_long,
23 pub sc_gs: c_long,
24 pub sc_fs: c_long,
25 pub sc_es: c_long,
26 pub sc_ds: c_long,
27 pub sc_trapno: c_long,
28 pub sc_err: c_long,
29 pub sc_rip: c_long,
30 pub sc_cs: c_long,
31 pub sc_rflags: c_long,
32 pub sc_rsp: c_long,
33 pub sc_ss: c_long,
34 pub sc_fpstate: *mut fxsave64,
35 __sc_unused: c_int,
36 pub sc_mask: c_int,
37 pub sc_cookie: c_long,
38 }
39 }
40
41 s_no_extra_traits! {
42 #[repr(packed)]
43 pub struct fxsave64 {
44 pub fx_fcw: u16,
45 pub fx_fsw: u16,
46 pub fx_ftw: u8,
47 __fx_unused1: u8,
48 pub fx_fop: u16,
49 pub fx_rip: u64,
50 pub fx_rdp: u64,
51 pub fx_mxcsr: u32,
52 pub fx_mxcsr_mask: u32,
53 pub fx_st: [[u64; 2]; 8],
54 pub fx_xmm: [[u64; 2]; 16],
55 __fx_unused3: [u8; 96],
56 }
57 }
58
59 cfg_if! {
60 if #[cfg(feature = "extra_traits")] {
61 // `fxsave64` is packed, so field access is unaligned.
62 // use {x} to create temporary storage, copy field to it, and do aligned access.
63 impl PartialEq for fxsave64 {
64 fn eq(&self, other: &fxsave64) -> bool {
65 return { self.fx_fcw } == { other.fx_fcw }
66 && { self.fx_fsw } == { other.fx_fsw }
67 && { self.fx_ftw } == { other.fx_ftw }
68 && { self.fx_fop } == { other.fx_fop }
69 && { self.fx_rip } == { other.fx_rip }
70 && { self.fx_rdp } == { other.fx_rdp }
71 && { self.fx_mxcsr } == { other.fx_mxcsr }
72 && { self.fx_mxcsr_mask } == { other.fx_mxcsr_mask }
73 && { self.fx_st }
74 .iter()
75 .zip({ other.fx_st }.iter())
76 .all(|(a, b)| a == b)
77 && { self.fx_xmm }
78 .iter()
79 .zip({ other.fx_xmm }.iter())
80 .all(|(a, b)| a == b);
81 }
82 }
83 impl Eq for fxsave64 {}
84 impl fmt::Debug for fxsave64 {
85 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
86 f.debug_struct("fxsave64")
87 .field("fx_fcw", &{ self.fx_fcw })
88 .field("fx_fsw", &{ self.fx_fsw })
89 .field("fx_ftw", &{ self.fx_ftw })
90 .field("fx_fop", &{ self.fx_fop })
91 .field("fx_rip", &{ self.fx_rip })
92 .field("fx_rdp", &{ self.fx_rdp })
93 .field("fx_mxcsr", &{ self.fx_mxcsr })
94 .field("fx_mxcsr_mask", &{ self.fx_mxcsr_mask })
95 // FIXME(debug): .field("fx_st", &{self.fx_st})
96 // FIXME(debug): .field("fx_xmm", &{self.fx_xmm})
97 .finish()
98 }
99 }
100 impl hash::Hash for fxsave64 {
101 fn hash<H: hash::Hasher>(&self, state: &mut H) {
102 { self.fx_fcw }.hash(state);
103 { self.fx_fsw }.hash(state);
104 { self.fx_ftw }.hash(state);
105 { self.fx_fop }.hash(state);
106 { self.fx_rip }.hash(state);
107 { self.fx_rdp }.hash(state);
108 { self.fx_mxcsr }.hash(state);
109 { self.fx_mxcsr_mask }.hash(state);
110 { self.fx_st }.hash(state);
111 { self.fx_xmm }.hash(state);
112 }
113 }
114 }
115 }
116
117 pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_long>() - 1;
118
119 pub const _MAX_PAGE_SHIFT: u32 = 12;
120
121 pub const PT_STEP: c_int = PT_FIRSTMACH + 0;
122 pub const PT_GETREGS: c_int = PT_FIRSTMACH + 1;
123 pub const PT_SETREGS: c_int = PT_FIRSTMACH + 2;
124 pub const PT_GETFPREGS: c_int = PT_FIRSTMACH + 3;
125 pub const PT_SETFPREGS: c_int = PT_FIRSTMACH + 4;