1 pub type c_char = u8;
2 pub type c_long = i64;
3 pub type c_ulong = u64;
4 pub type wchar_t = u32;
5 pub type time_t = i64;
6 pub type suseconds_t = i64;
7 pub type register_t = i64;
8 
9 // should be pub(crate), but that requires Rust 1.18.0
10 cfg_if! {
11     if #[cfg(libc_const_size_of)] {
12         #[doc(hidden)]
13         pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
14     } else {
15         #[doc(hidden)]
16         pub const _ALIGNBYTES: usize = 8 - 1;
17     }
18 }
19 
20 s_no_extra_traits! {
21     pub struct gpregs {
22         pub gp_x: [::register_t; 30],
23         pub gp_lr: ::register_t,
24         pub gp_sp: ::register_t,
25         pub gp_elr: ::register_t,
26         pub gp_spsr: u32,
27         pub gp_pad: ::c_int,
28     }
29 
30     pub struct fpregs {
31         pub fp_q: u128,
32         pub fp_sr: u32,
33         pub fp_cr: u32,
34         pub fp_flags: ::c_int,
35         pub fp_pad: ::c_int,
36     }
37 
38     pub struct mcontext_t {
39         pub mc_gpregs: gpregs,
40         pub mc_fpregs: fpregs,
41         pub mc_flags: ::c_int,
42         pub mc_pad: ::c_int,
43         pub mc_spare: [u64; 8],
44     }
45 }
46 
47 cfg_if! {
48     if #[cfg(feature = "extra_traits")] {
49         impl PartialEq for gpregs {
50             fn eq(&self, other: &gpregs) -> bool {
51                 self.gp_x.iter().zip(other.gp_x.iter()).all(|(a, b)| a == b) &&
52                 self.gp_lr == other.gp_lr &&
53                 self.gp_sp == other.gp_sp &&
54                 self.gp_elr == other.gp_elr &&
55                 self.gp_spsr == other.gp_spsr &&
56                 self.gp_pad == other.gp_pad
57             }
58         }
59         impl Eq for gpregs {}
60         impl ::fmt::Debug for gpregs {
61             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
62                 f.debug_struct("gpregs")
63                     .field("gp_x", &self.gp_x)
64                     .field("gp_lr", &self.gp_lr)
65                     .field("gp_sp", &self.gp_sp)
66                     .field("gp_elr", &self.gp_elr)
67                     .field("gp_spsr", &self.gp_spsr)
68                     .field("gp_pad", &self.gp_pad)
69                     .finish()
70             }
71         }
72         impl ::hash::Hash for gpregs {
73             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
74                 self.gp_x.hash(state);
75                 self.gp_lr.hash(state);
76                 self.gp_sp.hash(state);
77                 self.gp_elr.hash(state);
78                 self.gp_spsr.hash(state);
79                 self.gp_pad.hash(state);
80             }
81         }
82         impl PartialEq for fpregs {
83             fn eq(&self, other: &fpregs) -> bool {
84                 self.fp_q == other.fp_q &&
85                 self.fp_sr == other.fp_sr &&
86                 self.fp_cr == other.fp_cr &&
87                 self.fp_flags == other.fp_flags &&
88                 self.fp_pad == other.fp_pad
89             }
90         }
91         impl Eq for fpregs {}
92         impl ::fmt::Debug for fpregs {
93             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
94                 f.debug_struct("fpregs")
95                     .field("fp_q", &self.fp_q)
96                     .field("fp_sr", &self.fp_sr)
97                     .field("fp_cr", &self.fp_cr)
98                     .field("fp_flags", &self.fp_flags)
99                     .field("fp_pad", &self.fp_pad)
100                     .finish()
101             }
102         }
103         impl ::hash::Hash for fpregs {
104             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
105                 self.fp_q.hash(state);
106                 self.fp_sr.hash(state);
107                 self.fp_cr.hash(state);
108                 self.fp_flags.hash(state);
109                 self.fp_pad.hash(state);
110             }
111         }
112         impl PartialEq for mcontext_t {
113             fn eq(&self, other: &mcontext_t) -> bool {
114                 self.mc_gpregs == other.mc_gpregs &&
115                 self.mc_fpregs == other.mc_fpregs &&
116                 self.mc_flags == other.mc_flags &&
117                 self.mc_pad == other.mc_pad &&
118                 self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b)
119             }
120         }
121         impl Eq for mcontext_t {}
122         impl ::fmt::Debug for mcontext_t {
123             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
124                 f.debug_struct("mcontext_t")
125                     .field("mc_gpregs", &self.mc_gpregs)
126                     .field("mc_fpregs", &self.mc_fpregs)
127                     .field("mc_flags", &self.mc_flags)
128                     .field("mc_pad", &self.mc_pad)
129                     .field("mc_spare", &self.mc_spare)
130                     .finish()
131             }
132         }
133         impl ::hash::Hash for mcontext_t {
134             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
135                 self.mc_gpregs.hash(state);
136                 self.mc_fpregs.hash(state);
137                 self.mc_flags.hash(state);
138                 self.mc_pad.hash(state);
139                 self.mc_spare.hash(state);
140             }
141         }
142     }
143 }
144 
145 pub const MAP_32BIT: ::c_int = 0x00080000;
146 pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
147