about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/windows/mod.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs
index a0d5a7471d8..8fbd43ad5a5 100644
--- a/library/std/src/sys/windows/mod.rs
+++ b/library/std/src/sys/windows/mod.rs
@@ -306,10 +306,20 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
 /// that function for more information on `__fastfail`
 #[allow(unreachable_code)]
 pub fn abort_internal() -> ! {
-    #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+    const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
     unsafe {
-        llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
-        crate::intrinsics::unreachable();
+        cfg_if::cfg_if! {
+            if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
+                llvm_asm!("int $$0x29" :: "{ecx}"(FAST_FAIL_FATAL_APP_EXIT) ::: volatile);
+                crate::intrinsics::unreachable();
+            } else if #[cfg(target_arch = "arm")] {
+                llvm_asm!(".inst 0xDEFB" :: "{r0}"(FAST_FAIL_FATAL_APP_EXIT) ::: volatile);
+                crate::intrinsics::unreachable();
+            } else if #[cfg(target_arch = "aarch64")] {
+                llvm_asm!(".inst 0xF003" :: "{x0}"(FAST_FAIL_FATAL_APP_EXIT) ::: volatile);
+                crate::intrinsics::unreachable();
+            }
+        }
     }
     crate::intrinsics::abort();
 }