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 / solarish / x86_64.rs
| 1 | use crate::prelude::*; |
| 2 | |
| 3 | cfg_if! { |
| 4 | if #[cfg(target_os = "solaris")] { |
| 5 | use crate::unix::solarish::solaris; |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | pub type greg_t = c_long; |
| 10 | |
| 11 | pub type Elf64_Addr = c_ulong; |
| 12 | pub type Elf64_Half = c_ushort; |
| 13 | pub type Elf64_Off = c_ulong; |
| 14 | pub type Elf64_Sword = c_int; |
| 15 | pub type Elf64_Sxword = c_long; |
| 16 | pub type Elf64_Word = c_uint; |
| 17 | pub type Elf64_Xword = c_ulong; |
| 18 | pub type Elf64_Lword = c_ulong; |
| 19 | pub type Elf64_Phdr = __c_anonymous_Elf64_Phdr; |
| 20 | |
| 21 | s! { |
| 22 | pub struct __c_anonymous_fpchip_state { |
| 23 | pub cw: u16, |
| 24 | pub sw: u16, |
| 25 | pub fctw: u8, |
| 26 | pub __fx_rsvd: u8, |
| 27 | pub fop: u16, |
| 28 | pub rip: u64, |
| 29 | pub rdp: u64, |
| 30 | pub mxcsr: u32, |
| 31 | pub mxcsr_mask: u32, |
| 32 | pub st: [crate::upad128_t; 8], |
| 33 | pub xmm: [crate::upad128_t; 16], |
| 34 | pub __fx_ign: [crate::upad128_t; 6], |
| 35 | pub status: u32, |
| 36 | pub xstatus: u32, |
| 37 | } |
| 38 | |
| 39 | pub struct __c_anonymous_Elf64_Phdr { |
| 40 | pub p_type: crate::Elf64_Word, |
| 41 | pub p_flags: crate::Elf64_Word, |
| 42 | pub p_offset: crate::Elf64_Off, |
| 43 | pub p_vaddr: crate::Elf64_Addr, |
| 44 | pub p_paddr: crate::Elf64_Addr, |
| 45 | pub p_filesz: crate::Elf64_Xword, |
| 46 | pub p_memsz: crate::Elf64_Xword, |
| 47 | pub p_align: crate::Elf64_Xword, |
| 48 | } |
| 49 | |
| 50 | pub struct dl_phdr_info { |
| 51 | pub dlpi_addr: crate::Elf64_Addr, |
| 52 | pub dlpi_name: *const c_char, |
| 53 | pub dlpi_phdr: *const crate::Elf64_Phdr, |
| 54 | pub dlpi_phnum: crate::Elf64_Half, |
| 55 | pub dlpi_adds: c_ulonglong, |
| 56 | pub dlpi_subs: c_ulonglong, |
| 57 | #[cfg(target_os = "solaris")] |
| 58 | pub dlpi_tls_modid: c_ulong, |
| 59 | #[cfg(target_os = "solaris")] |
| 60 | pub dlpi_tls_data: *mut c_void, |
| 61 | } |
| 62 | |
| 63 | pub struct fpregset_t { |
| 64 | pub fp_reg_set: __c_anonymous_fp_reg_set, |
| 65 | } |
| 66 | |
| 67 | pub struct mcontext_t { |
| 68 | pub gregs: [crate::greg_t; 28], |
| 69 | pub fpregs: fpregset_t, |
| 70 | } |
| 71 | |
| 72 | pub struct ucontext_t { |
| 73 | pub uc_flags: c_ulong, |
| 74 | pub uc_link: *mut ucontext_t, |
| 75 | pub uc_sigmask: crate::sigset_t, |
| 76 | pub uc_stack: crate::stack_t, |
| 77 | pub uc_mcontext: mcontext_t, |
| 78 | #[cfg(target_os = "illumos")] |
| 79 | pub uc_brand_data: [*mut c_void; 3], |
| 80 | #[cfg(target_os = "illumos")] |
| 81 | pub uc_xsave: c_long, |
| 82 | #[cfg(target_os = "illumos")] |
| 83 | pub uc_filler: c_long, |
| 84 | #[cfg(target_os = "solaris")] |
| 85 | pub uc_xrs: solaris::xrs_t, |
| 86 | #[cfg(target_os = "solaris")] |
| 87 | pub uc_lwpid: c_uint, |
| 88 | #[cfg(target_os = "solaris")] |
| 89 | pub uc_filler: [c_long; 2], |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | s_no_extra_traits! { |
| 94 | pub union __c_anonymous_fp_reg_set { |
| 95 | pub fpchip_state: __c_anonymous_fpchip_state, |
| 96 | pub f_fpregs: [[u32; 13]; 10], |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | cfg_if! { |
| 101 | if #[cfg(feature = "extra_traits")] { |
| 102 | impl PartialEq for __c_anonymous_fp_reg_set { |
| 103 | fn eq(&self, other: &__c_anonymous_fp_reg_set) -> bool { |
| 104 | unsafe { |
| 105 | self.fpchip_state == other.fpchip_state |
| 106 | || self |
| 107 | .f_fpregs |
| 108 | .iter() |
| 109 | .zip(other.f_fpregs.iter()) |
| 110 | .all(|(a, b)| a == b) |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | impl Eq for __c_anonymous_fp_reg_set {} |
| 115 | impl hash::Hash for __c_anonymous_fp_reg_set { |
| 116 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 117 | unsafe { |
| 118 | self.f_fpregs.hash(state); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // sys/regset.h |
| 126 | |
| 127 | pub const REG_GSBASE: c_int = 27; |
| 128 | pub const REG_FSBASE: c_int = 26; |
| 129 | pub const REG_DS: c_int = 25; |
| 130 | pub const REG_ES: c_int = 24; |
| 131 | pub const REG_GS: c_int = 23; |
| 132 | pub const REG_FS: c_int = 22; |
| 133 | pub const REG_SS: c_int = 21; |
| 134 | pub const REG_RSP: c_int = 20; |
| 135 | pub const REG_RFL: c_int = 19; |
| 136 | pub const REG_CS: c_int = 18; |
| 137 | pub const REG_RIP: c_int = 17; |
| 138 | pub const REG_ERR: c_int = 16; |
| 139 | pub const REG_TRAPNO: c_int = 15; |
| 140 | pub const REG_RAX: c_int = 14; |
| 141 | pub const REG_RCX: c_int = 13; |
| 142 | pub const REG_RDX: c_int = 12; |
| 143 | pub const REG_RBX: c_int = 11; |
| 144 | pub const REG_RBP: c_int = 10; |
| 145 | pub const REG_RSI: c_int = 9; |
| 146 | pub const REG_RDI: c_int = 8; |
| 147 | pub const REG_R8: c_int = 7; |
| 148 | pub const REG_R9: c_int = 6; |
| 149 | pub const REG_R10: c_int = 5; |
| 150 | pub const REG_R11: c_int = 4; |
| 151 | pub const REG_R12: c_int = 3; |
| 152 | pub const REG_R13: c_int = 2; |
| 153 | pub const REG_R14: c_int = 1; |
| 154 | pub const REG_R15: c_int = 0; |