diff options
| author | Ryan Levick <ryan.levick@gmail.com> | 2020-08-10 14:08:31 +0200 |
|---|---|---|
| committer | Ryan Levick <ryan.levick@gmail.com> | 2020-08-10 14:40:09 +0200 |
| commit | 57572cf8096ccb332370f7a711641a061bfd7434 (patch) | |
| tree | ccc0151c90d63e4496d22ccf9efd3c7d7997080f | |
| parent | 13290e83a6e20f3b408d177a9d64d8cf98fe4615 (diff) | |
| download | rust-57572cf8096ccb332370f7a711641a061bfd7434.tar.gz rust-57572cf8096ccb332370f7a711641a061bfd7434.zip | |
Call into fastfail on abort in libpanic_abort on Windows x86(_64)
| -rw-r--r-- | library/panic_abort/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/library/panic_abort/src/lib.rs b/library/panic_abort/src/lib.rs index cf52091f609..339be6111aa 100644 --- a/library/panic_abort/src/lib.rs +++ b/library/panic_abort/src/lib.rs @@ -17,6 +17,7 @@ #![feature(panic_runtime)] #![feature(staged_api)] #![feature(rustc_attrs)] +#![feature(llvm_asm)] use core::any::Any; @@ -55,6 +56,19 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 { } __rust_abort(); } + } else if #[cfg(all(windows, any(target_arch = "x86", target_arch = "x86_64")))] { + // On Windows, use the processor-specific __fastfail mechanism. In Windows 8 + // and later, this will terminate the process immediately without running any + // in-process exception handlers. In earlier versions of Windows, this + // sequence of instructions will be treated as an access violation, + // terminating the process but without necessarily bypassing all exception + // handlers. + // + // https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail + unsafe fn abort() -> ! { + llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT + core::intrinsics::unreachable(); + } } else { unsafe fn abort() -> ! { core::intrinsics::abort(); |
