Debian Codegraph @

.cargo/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs

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