about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2016-09-30 23:07:04 +0000
committerBrian Anderson <banderson@mozilla.com>2016-11-01 17:08:24 +0000
commitf3a709dc52bb3e617ccb016a8b20a741c23da77d (patch)
tree7ce55285f2b9d329dadb0bb11dcb2abb8d55fa7b /src/libstd/sys/windows
parent219c018894b31fec7059ca89bb1ab0606068aeaf (diff)
downloadrust-f3a709dc52bb3e617ccb016a8b20a741c23da77d.tar.gz
rust-f3a709dc52bb3e617ccb016a8b20a741c23da77d.zip
std: Move platform-specific out of sys_common::util
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index 0610a0245ea..defc41c5f46 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -221,3 +221,17 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
         }
     }).unwrap_or(c::INFINITE)
 }
+
+// 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://msdn.microsoft.com/en-us/library/dn774154.aspx
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+pub unsafe fn abort_internal() -> ! {
+    asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
+    ::intrinsics::unreachable();
+}