diff options
author | Joshua M. Clulow <josh@sysmgr.org> | 2021-11-22 00:59:19 -0800 |
---|---|---|
committer | Joshua M. Clulow <josh@sysmgr.org> | 2022-02-10 15:54:25 -0800 |
commit | 0c2ae734d947627e98c2c238ee8901b5f487448a (patch) | |
tree | 30569e842140d267eab6511f2adf93e676488713 /src/unix/solarish | |
parent | 96e2e3aeb4b94717cd71065e109e521518965581 (diff) | |
download | rust-libc-0c2ae734d947627e98c2c238ee8901b5f487448a.tar.gz |
illumos: fixes for mcontext_t and related types
Some of the type information in the machine context types, with
particular focus on the padding unions, was not quite right. It seems
we have used the somewhat baroque "long double" in the system headers,
and Rust does not have a type that matches that data layout. I have
adjusted the structs to omit that member, but to be explicitly aligned
to match the C version.
I also gagged a test for the "fp_reg_set" member which is of an
anonymous union type.
Portions contributed by: Patrick Mooney <pmooney@pfmooney.com>
Diffstat (limited to 'src/unix/solarish')
-rw-r--r-- | src/unix/solarish/mod.rs | 18 | ||||
-rw-r--r-- | src/unix/solarish/x86_64.rs | 6 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index d0c255cbb3..784cec4c51 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -520,14 +520,16 @@ s_no_extra_traits! { } #[cfg(libc_union)] + #[cfg_attr(libc_align, repr(align(16)))] pub union pad128_t { - pub _q: ::c_double, + // pub _q in this structure would be a "long double", of 16 bytes pub _l: [i32; 4], } #[cfg(libc_union)] + #[cfg_attr(libc_align, repr(align(16)))] pub union upad128_t { - pub _q: ::c_double, + // pub _q in this structure would be a "long double", of 16 bytes pub _l: [u32; 4], } } @@ -859,7 +861,7 @@ cfg_if! { impl PartialEq for pad128_t { fn eq(&self, other: &pad128_t) -> bool { unsafe { - self._q == other._q || + // FIXME: self._q == other._q || self._l == other._l } } @@ -871,7 +873,7 @@ cfg_if! { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { unsafe { f.debug_struct("pad128_t") - .field("_q", &{self._q}) + // FIXME: .field("_q", &{self._q}) .field("_l", &{self._l}) .finish() } @@ -881,7 +883,7 @@ cfg_if! { impl ::hash::Hash for pad128_t { fn hash<H: ::hash::Hasher>(&self, state: &mut H) { unsafe { - state.write_i64(self._q as i64); + // FIXME: state.write_i64(self._q as i64); self._l.hash(state); } } @@ -890,7 +892,7 @@ cfg_if! { impl PartialEq for upad128_t { fn eq(&self, other: &upad128_t) -> bool { unsafe { - self._q == other._q || + // FIXME: self._q == other._q || self._l == other._l } } @@ -902,7 +904,7 @@ cfg_if! { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { unsafe { f.debug_struct("upad128_t") - .field("_q", &{self._q}) + // FIXME: .field("_q", &{self._q}) .field("_l", &{self._l}) .finish() } @@ -912,7 +914,7 @@ cfg_if! { impl ::hash::Hash for upad128_t { fn hash<H: ::hash::Hasher>(&self, state: &mut H) { unsafe { - state.write_i64(self._q as i64); + // FIXME: state.write_i64(self._q as i64); self._l.hash(state); } } diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index a7107b0a17..7eef2db121 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -32,7 +32,7 @@ s_no_extra_traits! { pub struct mcontext_t { pub gregs: [::greg_t; 28], - pub fpgregs: fpregset_t, + pub fpregs: fpregset_t, } pub struct ucontext_t { @@ -89,7 +89,7 @@ cfg_if! { impl PartialEq for mcontext_t { fn eq(&self, other: &mcontext_t) -> bool { self.gregs == other.gregs && - self.fpgregs == other.fpgregs + self.fpregs == other.fpregs } } impl Eq for mcontext_t {} @@ -97,7 +97,7 @@ cfg_if! { fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("mcontext_t") .field("gregs", &self.gregs) - .field("fpgregs", &self.fpgregs) + .field("fpregs", &self.fpregs) .finish() } } |