aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / unix / bsd / netbsdlike / netbsd / riscv64.rs
| 1 | use crate::prelude::*; |
| 2 | use crate::PT_FIRSTMACH; |
| 3 | |
| 4 | pub type __greg_t = u64; |
| 5 | pub type __cpu_simple_lock_nv_t = c_uint; |
| 6 | pub type __gregset_t = [__greg_t; _NGREG]; |
| 7 | pub type __fregset_t = [__fpreg; _NFREG]; |
| 8 | |
| 9 | s_no_extra_traits! { |
| 10 | pub union __fpreg { |
| 11 | pub u_u64: u64, |
| 12 | pub u_d: c_double, |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | s! { |
| 17 | pub struct mcontext_t { |
| 18 | pub __gregs: __gregset_t, |
| 19 | pub __fregs: __fregset_t, |
| 20 | __spare: [crate::__greg_t; 7], |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | cfg_if! { |
| 25 | if #[cfg(feature = "extra_traits")] { |
| 26 | impl PartialEq for __fpreg { |
| 27 | fn eq(&self, other: &__fpreg) -> bool { |
| 28 | unsafe { self.u_u64 == other.u_u64 || self.u_d == other.u_d } |
| 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 { |
| 35 | self.u_u64.hash(state); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // gcc for riscv64 defines `BIGGEST_ALIGNMENT`, but it's mesured in bits. |
| 43 | pub(crate) const __BIGGEST_ALIGNMENT_IN_BITS__: usize = 128; |
| 44 | // `_ALIGNBYTES` is measured in, well, bytes. |
| 45 | pub(crate) const _ALIGNBYTES: usize = (__BIGGEST_ALIGNMENT_IN_BITS__ / 8) - 1; |
| 46 | |
| 47 | pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0; |
| 48 | pub const PT_SETREGS: c_int = PT_FIRSTMACH + 1; |
| 49 | pub const PT_GETFPREGS: c_int = PT_FIRSTMACH + 2; |
| 50 | pub const PT_SETFPREGS: c_int = PT_FIRSTMACH + 3; |
| 51 | |
| 52 | pub const _NGREG: usize = 32; |
| 53 | pub const _NFREG: usize = 33; |
| 54 | |
| 55 | pub const _REG_X1: c_int = 0; |
| 56 | pub const _REG_X2: c_int = 1; |
| 57 | pub const _REG_X3: c_int = 2; |
| 58 | pub const _REG_X4: c_int = 3; |
| 59 | pub const _REG_X5: c_int = 4; |
| 60 | pub const _REG_X6: c_int = 5; |
| 61 | pub const _REG_X7: c_int = 6; |
| 62 | pub const _REG_X8: c_int = 7; |
| 63 | pub const _REG_X9: c_int = 8; |
| 64 | pub const _REG_X10: c_int = 9; |
| 65 | pub const _REG_X11: c_int = 10; |
| 66 | pub const _REG_X12: c_int = 11; |
| 67 | pub const _REG_X13: c_int = 12; |
| 68 | pub const _REG_X14: c_int = 13; |
| 69 | pub const _REG_X15: c_int = 14; |
| 70 | pub const _REG_X16: c_int = 15; |
| 71 | pub const _REG_X17: c_int = 16; |
| 72 | pub const _REG_X18: c_int = 17; |
| 73 | pub const _REG_X19: c_int = 18; |
| 74 | pub const _REG_X20: c_int = 19; |
| 75 | pub const _REG_X21: c_int = 20; |
| 76 | pub const _REG_X22: c_int = 21; |
| 77 | pub const _REG_X23: c_int = 22; |
| 78 | pub const _REG_X24: c_int = 23; |
| 79 | pub const _REG_X25: c_int = 24; |
| 80 | pub const _REG_X26: c_int = 25; |
| 81 | pub const _REG_X27: c_int = 26; |
| 82 | pub const _REG_X28: c_int = 27; |
| 83 | pub const _REG_X29: c_int = 28; |
| 84 | pub const _REG_X30: c_int = 29; |
| 85 | pub const _REG_X31: c_int = 30; |
| 86 | pub const _REG_PC: c_int = 31; |
| 87 | |
| 88 | pub const _REG_RA: c_int = _REG_X1; |
| 89 | pub const _REG_SP: c_int = _REG_X2; |
| 90 | pub const _REG_GP: c_int = _REG_X3; |
| 91 | pub const _REG_TP: c_int = _REG_X4; |
| 92 | pub const _REG_S0: c_int = _REG_X8; |
| 93 | pub const _REG_RV: c_int = _REG_X10; |
| 94 | pub const _REG_A0: c_int = _REG_X10; |
| 95 | |
| 96 | pub const _REG_F0: c_int = 0; |
| 97 | pub const _REG_FPCSR: c_int = 32; |