Skip to content

Commit 0b726ea

Browse files
committed
netbsd adding mcontext related data for riscv64
1 parent 40741ba commit 0b726ea

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

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

+91
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,102 @@ use PT_FIRSTMACH;
33
pub type c_long = i64;
44
pub type c_ulong = u64;
55
pub type c_char = u8;
6+
pub type __greg_t = u64;
67
pub type __cpu_simple_lock_nv_t = ::c_int;
78

9+
s! {
10+
pub struct mcontext_t {
11+
pub __gregs: [::greg_t; 32],
12+
pub __fregs: [__c_anonymous__fpreg; 33],
13+
__spare: [::__greg_t; 7],
14+
}
15+
16+
pub struct ucontext_t {
17+
pub uc_flags: ::c_uint,
18+
pub uc_link: *mut ucontext_t,
19+
pub uc_sigmask: ::sigset_t,
20+
pub uc_stack: ::stack_t,
21+
pub uc_mcontext: mcontext_t,
22+
}
23+
}
24+
25+
s_no_extra_traits! {
26+
pub union __c_anonymous__fpreg {
27+
pub u_u64: u64,
28+
pub u_d: ::c_double,
29+
}
30+
}
31+
32+
cfg_if! {
33+
if #[cfg(feature = "extra_traits")] {
34+
impl PartialEq for __c_anonymous__fpreg {
35+
fn eq(&self, other: &__c_anonymous__fpreg) -> bool {
36+
unsafe {
37+
self.u_u64 == other.u_u64
38+
|| self.u_ud == other.u_ud
39+
}
40+
}
41+
}
42+
impl Eq for __c_anonymous__fpreg {}
43+
impl ::fmt::Debug for __c_anonymous__fpreg {
44+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
45+
unsafe {
46+
f.debug_struct("__c_anonymous__fpreg")
47+
.field("u_u64", &self.u_u64)
48+
.field("u_ud", &self.u_ud)
49+
}
50+
}
51+
}
52+
}
53+
}
54+
855
pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
956

1057
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
1158
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
1259
pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
1360
pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
61+
62+
pub const _REG_X1: ::c_int = 0;
63+
pub const _REG_X2: ::c_int = 1;
64+
pub const _REG_X3: ::c_int = 2;
65+
pub const _REG_X4: ::c_int = 3;
66+
pub const _REG_X5: ::c_int = 4;
67+
pub const _REG_X6: ::c_int = 5;
68+
pub const _REG_X7: ::c_int = 6;
69+
pub const _REG_X8: ::c_int = 7;
70+
pub const _REG_X9: ::c_int = 8;
71+
pub const _REG_X10: ::c_int = 9;
72+
pub const _REG_X11: ::c_int = 10;
73+
pub const _REG_X12: ::c_int = 11;
74+
pub const _REG_X13: ::c_int = 12;
75+
pub const _REG_X14: ::c_int = 13;
76+
pub const _REG_X15: ::c_int = 14;
77+
pub const _REG_X16: ::c_int = 15;
78+
pub const _REG_X17: ::c_int = 16;
79+
pub const _REG_X18: ::c_int = 17;
80+
pub const _REG_X19: ::c_int = 18;
81+
pub const _REG_X20: ::c_int = 19;
82+
pub const _REG_X21: ::c_int = 20;
83+
pub const _REG_X22: ::c_int = 21;
84+
pub const _REG_X23: ::c_int = 22;
85+
pub const _REG_X24: ::c_int = 23;
86+
pub const _REG_X25: ::c_int = 24;
87+
pub const _REG_X26: ::c_int = 25;
88+
pub const _REG_X27: ::c_int = 26;
89+
pub const _REG_X28: ::c_int = 27;
90+
pub const _REG_X29: ::c_int = 28;
91+
pub const _REG_X30: ::c_int = 29;
92+
pub const _REG_X31: ::c_int = 30;
93+
pub const _REG_PC: ::c_int = 31;
94+
95+
pub const _REG_RA: ::c_int = _REG_X1;
96+
pub const _REG_SP: ::c_int = _REG_X2;
97+
pub const _REG_GP: ::c_int = _REG_X3;
98+
pub const _REG_TP: ::c_int = _REG_X4;
99+
pub const _REG_S0: ::c_int = _REG_X8;
100+
pub const _REG_RV: ::c_int = _REG_X10;
101+
pub const _REG_A0: ::c_int = _REG_X10;
102+
103+
pub const _REG_F0: ::c_int = 0;
104+
pub const _REG_FPCSR: ::c_int = 32;

0 commit comments

Comments
 (0)