Skip to content

Commit

Permalink
Auto merge of #1990 - JohnTitor:arm-macos-state64, r=JohnTitor
Browse files Browse the repository at this point in the history
Fix `thread_state64` on `aarch64-apple-darwin`

Fixes #1977
  • Loading branch information
bors committed Dec 12, 2020
2 parents 9d70c06 + 36f9c1f commit 843f331
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 40 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,10 @@ jobs:
name: Semver Linux
needs: build_channels_linux
runs-on: ubuntu-20.04
continue-on-error: true
strategy:
fail-fast: true
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2
- name: Setup Rust toolchain
# Should update the semverver revision in semver.sh if we touch nightly ver.
Expand All @@ -243,12 +241,10 @@ jobs:
name: Semver macOS
needs: build_channels_macos
runs-on: macos-10.15
continue-on-error: true
strategy:
fail-fast: true
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2
- name: Setup Rust toolchain
# FIXME: Pin nightly version to make semverver compilable.
Expand Down Expand Up @@ -291,8 +287,6 @@ jobs:
docker_switch,
build_channels_linux,
build_channels_macos,
semver_linux,
semver_macos,
docs,
]

Expand All @@ -313,8 +307,6 @@ jobs:
docker_switch,
build_channels_linux,
build_channels_macos,
semver_linux,
semver_macos,
docs,
]

Expand Down
17 changes: 17 additions & 0 deletions src/unix/bsd/apple/b64/aarch64.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
s! {
pub struct __darwin_mcontext64 {
pub __es: ::__darwin_x86_exception_state64,
pub __ss: __darwin_arm_thread_state64,
pub __fs: ::__darwin_x86_float_state64,
}

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,
}
}
42 changes: 12 additions & 30 deletions src/unix/bsd/apple/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,13 @@ s! {
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,
Expand Down Expand Up @@ -220,3 +190,15 @@ cfg_if! {
pub use self::align::*;
}
}

cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
} else if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else {
// Unknown target_arch
}
}
31 changes: 31 additions & 0 deletions src/unix/bsd/apple/b64/x86_64.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
s! {
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_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,
}
}

0 comments on commit 843f331

Please sign in to comment.