| 1 |
use crate::prelude::*; |
| 2 |
|
| 3 |
pub type boolean_t = c_uint; |
| 4 |
pub type mcontext_t = *mut __darwin_mcontext64; |
| 5 |
|
| 6 |
s! { |
| 7 |
pub struct ucontext_t { |
| 8 |
pub uc_onstack: c_int, |
| 9 |
pub uc_sigmask: crate::sigset_t, |
| 10 |
pub uc_stack: crate::stack_t, |
| 11 |
pub uc_link: *mut crate::ucontext_t, |
| 12 |
pub uc_mcsize: usize, |
| 13 |
pub uc_mcontext: mcontext_t, |
| 14 |
} |
| 15 |
|
| 16 |
pub struct __darwin_mcontext64 { |
| 17 |
pub __es: __darwin_x86_exception_state64, |
| 18 |
pub __ss: __darwin_x86_thread_state64, |
| 19 |
pub __fs: __darwin_x86_float_state64, |
| 20 |
} |
| 21 |
|
| 22 |
pub struct __darwin_x86_exception_state64 { |
| 23 |
pub __trapno: u16, |
| 24 |
pub __cpu: u16, |
| 25 |
pub __err: u32, |
| 26 |
pub __faultvaddr: u64, |
| 27 |
} |
| 28 |
|
| 29 |
pub struct __darwin_x86_thread_state64 { |
| 30 |
pub __rax: u64, |
| 31 |
pub __rbx: u64, |
| 32 |
pub __rcx: u64, |
| 33 |
pub __rdx: u64, |
| 34 |
pub __rdi: u64, |
| 35 |
pub __rsi: u64, |
| 36 |
pub __rbp: u64, |
| 37 |
pub __rsp: u64, |
| 38 |
pub __r8: u64, |
| 39 |
pub __r9: u64, |
| 40 |
pub __r10: u64, |
| 41 |
pub __r11: u64, |
| 42 |
pub __r12: u64, |
| 43 |
pub __r13: u64, |
| 44 |
pub __r14: u64, |
| 45 |
pub __r15: u64, |
| 46 |
pub __rip: u64, |
| 47 |
pub __rflags: u64, |
| 48 |
pub __cs: u64, |
| 49 |
pub __fs: u64, |
| 50 |
pub __gs: u64, |
| 51 |
} |
| 52 |
|
| 53 |
pub struct __darwin_x86_float_state64 { |
| 54 |
pub __fpu_reserved: [c_int; 2], |
| 55 |
__fpu_fcw: c_short, |
| 56 |
__fpu_fsw: c_short, |
| 57 |
pub __fpu_ftw: u8, |
| 58 |
pub __fpu_rsrv1: u8, |
| 59 |
pub __fpu_fop: u16, |
| 60 |
pub __fpu_ip: u32, |
| 61 |
pub __fpu_cs: u16, |
| 62 |
pub __fpu_rsrv2: u16, |
| 63 |
pub __fpu_dp: u32, |
| 64 |
pub __fpu_ds: u16, |
| 65 |
pub __fpu_rsrv3: u16, |
| 66 |
pub __fpu_mxcsr: u32, |
| 67 |
pub __fpu_mxcsrmask: u32, |
| 68 |
pub __fpu_stmm0: __darwin_mmst_reg, |
| 69 |
pub __fpu_stmm1: __darwin_mmst_reg, |
| 70 |
pub __fpu_stmm2: __darwin_mmst_reg, |
| 71 |
pub __fpu_stmm3: __darwin_mmst_reg, |
| 72 |
pub __fpu_stmm4: __darwin_mmst_reg, |
| 73 |
pub __fpu_stmm5: __darwin_mmst_reg, |
| 74 |
pub __fpu_stmm6: __darwin_mmst_reg, |
| 75 |
pub __fpu_stmm7: __darwin_mmst_reg, |
| 76 |
pub __fpu_xmm0: __darwin_xmm_reg, |
| 77 |
pub __fpu_xmm1: __darwin_xmm_reg, |
| 78 |
pub __fpu_xmm2: __darwin_xmm_reg, |
| 79 |
pub __fpu_xmm3: __darwin_xmm_reg, |
| 80 |
pub __fpu_xmm4: __darwin_xmm_reg, |
| 81 |
pub __fpu_xmm5: __darwin_xmm_reg, |
| 82 |
pub __fpu_xmm6: __darwin_xmm_reg, |
| 83 |
pub __fpu_xmm7: __darwin_xmm_reg, |
| 84 |
pub __fpu_xmm8: __darwin_xmm_reg, |
| 85 |
pub __fpu_xmm9: __darwin_xmm_reg, |
| 86 |
pub __fpu_xmm10: __darwin_xmm_reg, |
| 87 |
pub __fpu_xmm11: __darwin_xmm_reg, |
| 88 |
pub __fpu_xmm12: __darwin_xmm_reg, |
| 89 |
pub __fpu_xmm13: __darwin_xmm_reg, |
| 90 |
pub __fpu_xmm14: __darwin_xmm_reg, |
| 91 |
pub __fpu_xmm15: __darwin_xmm_reg, |
| 92 |
// this field is actually [u8; 96], but defining it with a bigger type |
| 93 |
// allows us to auto-implement traits for it since the length of the |
| 94 |
// array is less than 32 |
| 95 |
__fpu_rsrv4: [u32; 24], |
| 96 |
pub __fpu_reserved1: c_int, |
| 97 |
} |
| 98 |
|
| 99 |
pub struct __darwin_mmst_reg { |
| 100 |
pub __mmst_reg: [c_char; 10], |
| 101 |
pub __mmst_rsrv: [c_char; 6], |
| 102 |
} |
| 103 |
|
| 104 |
pub struct __darwin_xmm_reg { |
| 105 |
pub __xmm_reg: [c_char; 16], |
| 106 |
} |
| 107 |
|
| 108 |
pub struct malloc_introspection_t { |
| 109 |
_private: [crate::uintptr_t; 16], // FIXME(macos): keeping private for now |
| 110 |
} |
| 111 |
|
| 112 |
pub struct malloc_zone_t { |
| 113 |
_reserved1: *mut c_void, |
| 114 |
_reserved2: *mut c_void, |
| 115 |
pub size: |
| 116 |
Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, ptr: *const c_void) -> size_t>, |
| 117 |
pub malloc: |
| 118 |
Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, size: size_t) -> *mut c_void>, |
| 119 |
pub calloc: Option< |
| 120 |
unsafe extern "C" fn( |
| 121 |
zone: *mut malloc_zone_t, |
| 122 |
num_items: size_t, |
| 123 |
size: size_t, |
| 124 |
) -> *mut c_void, |
| 125 |
>, |
| 126 |
pub valloc: |
| 127 |
Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, size: size_t) -> *mut c_void>, |
| 128 |
pub free: Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, ptr: *mut c_void)>, |
| 129 |
pub realloc: Option< |
| 130 |
unsafe extern "C" fn( |
| 131 |
zone: *mut malloc_zone_t, |
| 132 |
ptr: *mut c_void, |
| 133 |
size: size_t, |
| 134 |
) -> *mut c_void, |
| 135 |
>, |
| 136 |
pub destroy: Option<unsafe extern "C" fn(zone: *mut malloc_zone_t)>, |
| 137 |
pub zone_name: *const c_char, |
| 138 |
pub batch_malloc: Option< |
| 139 |
unsafe extern "C" fn( |
| 140 |
zone: *mut malloc_zone_t, |
| 141 |
size: size_t, |
| 142 |
results: *mut *mut c_void, |
| 143 |
num_requested: c_uint, |
| 144 |
) -> c_uint, |
| 145 |
>, |
| 146 |
pub batch_free: Option< |
| 147 |
unsafe extern "C" fn( |
| 148 |
zone: *mut malloc_zone_t, |
| 149 |
to_be_freed: *mut *mut c_void, |
| 150 |
num_to_be_freed: c_uint, |
| 151 |
), |
| 152 |
>, |
| 153 |
pub introspect: *mut malloc_introspection_t, |
| 154 |
pub version: c_uint, |
| 155 |
pub memalign: Option< |
| 156 |
unsafe extern "C" fn( |
| 157 |
zone: *mut malloc_zone_t, |
| 158 |
alignment: size_t, |
| 159 |
size: size_t, |
| 160 |
) -> *mut c_void, |
| 161 |
>, |
| 162 |
pub free_definite_size: |
| 163 |
Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, ptr: *mut c_void, size: size_t)>, |
| 164 |
pub pressure_relief: |
| 165 |
Option<unsafe extern "C" fn(zone: *mut malloc_zone_t, goal: size_t) -> size_t>, |
| 166 |
pub claimed_address: Option< |
| 167 |
unsafe extern "C" fn(zone: *mut malloc_zone_t, ptr: *mut c_void) -> crate::boolean_t, |
| 168 |
>, |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
s_no_extra_traits! { |
| 173 |
#[allow(missing_debug_implementations)] |
| 174 |
#[repr(align(16))] |
| 175 |
pub struct max_align_t { |
| 176 |
priv_: [f64; 2], |
| 177 |
} |
| 178 |
} |