Skip to content

Commit cd8d023

Browse files
committed
NetBSD: riscv64: Fix the mcontext types
Currently this target fails to build. (backport <rust-lang#4782>) (cherry picked from commit 368df02)
1 parent daa0137 commit cd8d023

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/unix/bsd/netbsdlike/netbsd/riscv64.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
use PT_FIRSTMACH;
2-
31
use crate::prelude::*;
2+
use crate::PT_FIRSTMACH;
43

54
pub type __greg_t = u64;
65
pub type __cpu_simple_lock_nv_t = c_int;
76
pub type __gregset = [__greg_t; _NGREG];
8-
pub type __fregset = [__freg; _NFREG];
7+
pub type __fregset = [__fpreg; _NFREG];
98

109
s! {
1110
pub struct mcontext_t {
1211
pub __gregs: __gregset,
13-
pub __fregs: __fpregset,
12+
pub __fregs: __fregset,
1413
__spare: [crate::__greg_t; 7],
1514
}
1615
}
@@ -22,6 +21,22 @@ s_no_extra_traits! {
2221
}
2322
}
2423

24+
cfg_if! {
25+
if #[cfg(feature = "extra_traits")] {
26+
impl PartialEq for __fpreg {
27+
fn eq(&self, other: &Self) -> bool {
28+
unsafe { self.u_u64 == other.u_u64 }
29+
}
30+
}
31+
impl Eq for __fpreg {}
32+
impl hash::Hash for __fpreg {
33+
fn hash<H: hash::Hasher>(&self, state: &mut H) {
34+
unsafe { self.u_u64.hash(state) };
35+
}
36+
}
37+
}
38+
}
39+
2540
pub(crate) const _ALIGNBYTES: usize = size_of::<c_long>() - 1;
2641

2742
pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0;

0 commit comments

Comments
 (0)