diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f4fab4082..a3c05f9990 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -183,6 +183,20 @@ jobs: - run: cargo check --target wasm32-unknown-emscripten -p wasi-common - run: cargo check --target armv7-unknown-linux-gnueabihf -p wasi-common + # Check whether `wasmtime` cross-compiles to aarch64-pc-windows-msvc + # We don't build nor test it because it lacks trap handling. + # Tracking issue: https://github.com/bytecodealliance/wasmtime/issues/4992 + checks_winarm64: + name: Check Windows ARM64 + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: ./.github/actions/install-rust + - run: rustup target add aarch64-pc-windows-msvc + - run: cargo check -p wasmtime --target aarch64-pc-windows-msvc + fuzz_targets: name: Fuzz Targets runs-on: ubuntu-latest diff --git a/crates/jit/src/unwind.rs b/crates/jit/src/unwind.rs index eedb52e143..3de3074201 100644 --- a/crates/jit/src/unwind.rs +++ b/crates/jit/src/unwind.rs @@ -5,6 +5,9 @@ cfg_if::cfg_if! { } else if #[cfg(all(windows, target_arch = "x86"))] { mod winx32; pub use self::winx32::*; + } else if #[cfg(all(windows, target_arch = "aarch64"))] { + mod winx64; + pub use self::winx64::*; } else if #[cfg(unix)] { mod systemv; pub use self::systemv::*; diff --git a/crates/jit/src/unwind/winx64.rs b/crates/jit/src/unwind/winx64.rs index 9ddbcfca9a..23ccbe285c 100644 --- a/crates/jit/src/unwind/winx64.rs +++ b/crates/jit/src/unwind/winx64.rs @@ -21,7 +21,7 @@ impl UnwindRegistration { if RtlAddFunctionTable( unwind_info as *mut _, (unwind_len / unit_len) as u32, - base_address as u64, + base_address as _, ) == 0 { bail!("failed to register function table"); diff --git a/crates/runtime/src/traphandlers/windows.rs b/crates/runtime/src/traphandlers/windows.rs index 8931503fec..c76c1b0c06 100644 --- a/crates/runtime/src/traphandlers/windows.rs +++ b/crates/runtime/src/traphandlers/windows.rs @@ -58,6 +58,9 @@ unsafe extern "system" fn exception_handler(exception_info: *mut EXCEPTION_POINT } else if #[cfg(target_arch = "x86")] { let ip = (*(*exception_info).ContextRecord).Eip as *const u8; let fp = (*(*exception_info).ContextRecord).Ebp as usize; + } else if #[cfg(target_arch = "aarch64")] { + let ip = (*(*exception_info).ContextRecord).Pc as *const u8; + let fp = (*(*exception_info).ContextRecord).Anonymous.Anonymous.Fp as usize; } else { compile_error!("unsupported platform"); }