Skip to content

Commit 0cf7b81

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

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

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

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,94 @@ 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+
17+
s_no_extra_traits! {
18+
pub union __c_anonymous__fpreg {
19+
pub u_u64: u64,
20+
pub u_d: ::c_double,
21+
}
22+
}
23+
24+
cfg_if! {
25+
if #[cfg(feature = "extra_traits")] {
26+
impl PartialEq for __c_anonymous__fpreg {
27+
fn eq(&self, other: &__c_anonymous__fpreg) -> bool {
28+
unsafe {
29+
self.u_u64 == other.u_u64
30+
|| self.u_ud == other.u_ud
31+
}
32+
}
33+
}
34+
impl Eq for __c_anonymous__fpreg {}
35+
impl ::fmt::Debug for __c_anonymous__fpreg {
36+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
37+
unsafe {
38+
f.debug_struct("__c_anonymous__fpreg")
39+
.field("u_u64", &self.u_u64)
40+
.field("u_ud", &self.u_ud)
41+
}
42+
}
43+
}
44+
}
45+
}
46+
847
pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
948

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

0 commit comments

Comments
 (0)