Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub type idtype_t = c_int;
type __pthread_spin_t = __cpu_simple_lock_nv_t;
pub type shmatt_t = c_uint;
pub type cpuset_t = _cpuset;
pub type pthread_spin_t = c_uchar;
pub type pthread_spin_t = __pthread_spin_t;

// elf.h

Expand Down
62 changes: 36 additions & 26 deletions src/unix/bsd/netbsdlike/netbsd/riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,52 @@ use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type __greg_t = u64;
pub type __cpu_simple_lock_nv_t = c_int;
pub type __gregset = [__greg_t; _NGREG];
pub type __fregset = [__fpreg; _NFREG];
pub union __fpreg {
pub u_u64: u64,
pub u_d: c_double,
}
pub type __cpu_simple_lock_nv_t = c_uint;
pub type __gregset_t = [__greg_t; _NGREG];
pub type __fregset_t = [__fpreg; _NFREG];

s! {
pub struct mcontext_t {
pub __gregs: __gregset,
pub __fregs: __fregset,
__spare: [crate::__greg_t; 7],
}
#[derive(Debug)]
pub struct mcontext_t {
pub __gregs: __gregset_t,
pub __fregs: __fregset_t,
__spare: [crate::__greg_t; 7],
}

s_no_extra_traits! {
pub union __fpreg {
pub u_u64: u64,
pub u_d: c_double,
impl core::cmp::PartialEq for __fpreg {
fn eq(&self, other: &__fpreg) -> bool {
unsafe { self.u_u64 == other.u_u64 || self.u_d == other.u_d }
}
}

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for __fpreg {
fn eq(&self, other: &Self) -> bool {
unsafe { self.u_u64 == other.u_u64 }
}
impl core::cmp::Eq for __fpreg {}
impl core::marker::Copy for __fpreg {}
impl core::clone::Clone for __fpreg {
fn clone(&self) -> __fpreg {
*self
}
}
impl hash::Hash for __fpreg {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe {
self.u_u64.hash(state);
}
impl Eq for __fpreg {}
impl hash::Hash for __fpreg {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe { self.u_u64.hash(state) };
}
}
}
impl core::fmt::Debug for __fpreg {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe {
f.debug_struct("__fpreg")
.field("u_u64", &self.u_u64)
.field("u_d", &self.u_d)
.finish()
}
}
}

pub(crate) const _ALIGNBYTES: usize = size_of::<c_long>() - 1;
pub(crate) const _ALIGNBYTES: usize = 0xf;

pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0;
pub const PT_SETREGS: c_int = PT_FIRSTMACH + 1;
Expand Down