You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on making Wasmer and work in the Apple Silicon, I realized there were some issues on the layout that rust libc thinks the thread state has, which are different in x86_64 and arm64.
Currently rust libc uses __darwin_x86_thread_state64 when accessing to ucontext_t.uc_mcontext.__ss, which has an invalid layout in the Apple ARM M1 context.
The structure in macOS Big Sur is defined as follows (mach/arm/_structs.h):
_STRUCT_ARM_THREAD_STATE64
{
__uint64_tx[29]; /* General purpose registers x0-x28 */void*__opaque_fp; /* Frame pointer x29 */void*__opaque_lr; /* Link register x30 */void*__opaque_sp; /* Stack pointer x31 */void*__opaque_pc; /* Program counter */__uint32_tcpsr; /* Current program status register */__uint32_t__opaque_flags; /* Flags describing structure format */
};
Which translates roughly to:
pubstruct__darwin_arm_thread_state64{pub__x:[u64;29],/* General purpose registers x0-x28 */pub__fp:u64,/* Frame pointer x29 */pub__lr:u64,/* Link register x30 */pub__sp:u64,/* Stack pointer x31 */pub__pc:u64,/* Program counter */pub__cpsr:u32,/* Current program status register */pub__pad:u32,/* Same size for 32-bit or 64-bit clients */};
The codebase should be updated to use the new layout for the Apple Silicon
The text was updated successfully, but these errors were encountered:
Since libc 0.2.82, the issue
rust-lang/libc#1977 has been fixed with
rust-lang/libc#1990. Our current version of
libc is 0.2.87. Let's update our code to remove the
`__darwin_arm_thread_state64` type, and use the one from libc.
When working on making Wasmer and work in the Apple Silicon, I realized there were some issues on the layout that rust libc thinks the thread state has, which are different in
x86_64
andarm64
.Currently rust libc uses
__darwin_x86_thread_state64
when accessing toucontext_t.uc_mcontext.__ss
, which has an invalid layout in the Apple ARM M1 context.libc/src/unix/bsd/apple/b64/mod.rs
Lines 75 to 97 in d2963c2
The structure in macOS Big Sur is defined as follows (
mach/arm/_structs.h
):Which translates roughly to:
The codebase should be updated to use the new layout for the Apple Silicon
The text was updated successfully, but these errors were encountered: