Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2008 - bsteinb:macos-aarch64-mcontext, r=JohnTitor
Make test suite pass on macOS on aarch64 While working on #2007 I tried to run `cargo test` in `libc-test`, which failed, because the definition of `__darwin_mcontext64` was incomplete (see #1990). This adds definitions for the exception state and the floating point state as well. `libc-test` still does not pass, because I use the type `[u128; 32]` for the `__v` field of `__darwin_arm_neon_state64` (in C it is `__uint128_t __v[32]`. `ctest2` does not translate `u128` to `__uint128_t` and the generated C code does not compile. Any ideas for working around this?
- Loading branch information
Showing
10 changed files
with
191 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
pub type mcontext_t = *mut __darwin_mcontext64; | ||
|
||
s_no_extra_traits! { | ||
#[allow(missing_debug_implementations)] | ||
pub struct max_align_t { | ||
priv_: f64 | ||
} | ||
} | ||
|
||
s! { | ||
pub struct ucontext_t { | ||
pub uc_onstack: ::c_int, | ||
pub uc_sigmask: ::sigset_t, | ||
pub uc_stack: ::stack_t, | ||
pub uc_link: *mut ::ucontext_t, | ||
pub uc_mcsize: usize, | ||
pub uc_mcontext: mcontext_t, | ||
} | ||
|
||
pub struct __darwin_mcontext64 { | ||
pub __es: __darwin_arm_exception_state64, | ||
pub __ss: __darwin_arm_thread_state64, | ||
pub __ns: __darwin_arm_neon_state64, | ||
} | ||
|
||
pub struct __darwin_arm_exception_state64 { | ||
pub __far: u64, | ||
pub __esr: u32, | ||
pub __exception: u32, | ||
} | ||
|
||
pub struct __darwin_arm_thread_state64 { | ||
pub __x: [u64; 29], | ||
pub __fp: u64, | ||
pub __lr: u64, | ||
pub __sp: u64, | ||
pub __pc: u64, | ||
pub __cpsr: u32, | ||
pub __pad: u32, | ||
} | ||
|
||
#[repr(align(16))] | ||
pub struct __darwin_arm_neon_state64 { | ||
pub __v: [[u64; 2]; 32], | ||
pub __fpsr: u32, | ||
pub __fpcr: u32, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub type boolean_t = ::c_int; | ||
|
||
cfg_if! { | ||
if #[cfg(libc_align)] { | ||
mod align; | ||
pub use self::align::*; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
s_no_extra_traits! { | ||
#[allow(missing_debug_implementations)] | ||
#[repr(align(16))] | ||
pub struct max_align_t { | ||
priv_: [f64; 2] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
pub type boolean_t = ::c_uint; | ||
pub type mcontext_t = *mut __darwin_mcontext64; | ||
|
||
s! { | ||
pub struct ucontext_t { | ||
pub uc_onstack: ::c_int, | ||
pub uc_sigmask: ::sigset_t, | ||
pub uc_stack: ::stack_t, | ||
pub uc_link: *mut ::ucontext_t, | ||
pub uc_mcsize: usize, | ||
pub uc_mcontext: mcontext_t, | ||
} | ||
|
||
pub struct __darwin_mcontext64 { | ||
pub __es: __darwin_x86_exception_state64, | ||
pub __ss: __darwin_x86_thread_state64, | ||
pub __fs: __darwin_x86_float_state64, | ||
} | ||
|
||
pub struct __darwin_x86_exception_state64 { | ||
pub __trapno: u16, | ||
pub __cpu: u16, | ||
pub __err: u32, | ||
pub __faultvaddr: u64, | ||
} | ||
|
||
pub struct __darwin_x86_thread_state64 { | ||
pub __rax: u64, | ||
pub __rbx: u64, | ||
pub __rcx: u64, | ||
pub __rdx: u64, | ||
pub __rdi: u64, | ||
pub __rsi: u64, | ||
pub __rbp: u64, | ||
pub __rsp: u64, | ||
pub __r8: u64, | ||
pub __r9: u64, | ||
pub __r10: u64, | ||
pub __r11: u64, | ||
pub __r12: u64, | ||
pub __r13: u64, | ||
pub __r14: u64, | ||
pub __r15: u64, | ||
pub __rip: u64, | ||
pub __rflags: u64, | ||
pub __cs: u64, | ||
pub __fs: u64, | ||
pub __gs: u64, | ||
} | ||
|
||
pub struct __darwin_x86_float_state64 { | ||
pub __fpu_reserved: [::c_int; 2], | ||
__fpu_fcw: ::c_short, | ||
__fpu_fsw: ::c_short, | ||
pub __fpu_ftw: u8, | ||
pub __fpu_rsrv1: u8, | ||
pub __fpu_fop: u16, | ||
pub __fpu_ip: u32, | ||
pub __fpu_cs: u16, | ||
pub __fpu_rsrv2: u16, | ||
pub __fpu_dp: u32, | ||
pub __fpu_ds: u16, | ||
pub __fpu_rsrv3: u16, | ||
pub __fpu_mxcsr: u32, | ||
pub __fpu_mxcsrmask: u32, | ||
pub __fpu_stmm0: __darwin_mmst_reg, | ||
pub __fpu_stmm1: __darwin_mmst_reg, | ||
pub __fpu_stmm2: __darwin_mmst_reg, | ||
pub __fpu_stmm3: __darwin_mmst_reg, | ||
pub __fpu_stmm4: __darwin_mmst_reg, | ||
pub __fpu_stmm5: __darwin_mmst_reg, | ||
pub __fpu_stmm6: __darwin_mmst_reg, | ||
pub __fpu_stmm7: __darwin_mmst_reg, | ||
pub __fpu_xmm0: __darwin_xmm_reg, | ||
pub __fpu_xmm1: __darwin_xmm_reg, | ||
pub __fpu_xmm2: __darwin_xmm_reg, | ||
pub __fpu_xmm3: __darwin_xmm_reg, | ||
pub __fpu_xmm4: __darwin_xmm_reg, | ||
pub __fpu_xmm5: __darwin_xmm_reg, | ||
pub __fpu_xmm6: __darwin_xmm_reg, | ||
pub __fpu_xmm7: __darwin_xmm_reg, | ||
pub __fpu_xmm8: __darwin_xmm_reg, | ||
pub __fpu_xmm9: __darwin_xmm_reg, | ||
pub __fpu_xmm10: __darwin_xmm_reg, | ||
pub __fpu_xmm11: __darwin_xmm_reg, | ||
pub __fpu_xmm12: __darwin_xmm_reg, | ||
pub __fpu_xmm13: __darwin_xmm_reg, | ||
pub __fpu_xmm14: __darwin_xmm_reg, | ||
pub __fpu_xmm15: __darwin_xmm_reg, | ||
// this field is actually [u8; 96], but defining it with a bigger type | ||
// allows us to auto-implement traits for it since the length of the | ||
// array is less than 32 | ||
__fpu_rsrv4: [u32; 24], | ||
pub __fpu_reserved1: ::c_int, | ||
} | ||
|
||
pub struct __darwin_mmst_reg { | ||
pub __mmst_reg: [::c_char; 10], | ||
pub __mmst_rsrv: [::c_char; 6], | ||
} | ||
|
||
pub struct __darwin_xmm_reg { | ||
pub __xmm_reg: [::c_char; 16], | ||
} | ||
} | ||
|
||
cfg_if! { | ||
if #[cfg(libc_align)] { | ||
mod align; | ||
pub use self::align::*; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters