Debian Codegraph @

third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs

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