1717#![ feature( panic_runtime) ]
1818#![ feature( staged_api) ]
1919#![ feature( rustc_attrs) ]
20- #![ feature( llvm_asm ) ]
20+ #![ feature( asm ) ]
2121
2222use core:: any:: Any ;
2323
@@ -47,7 +47,7 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
4747 }
4848 __rust_abort( ) ;
4949 }
50- } else if #[ cfg( all ( windows, any ( target_arch = "x86" , target_arch = "x86_64" ) ) ) ] {
50+ } else if #[ cfg( windows) ] {
5151 // On Windows, use the processor-specific __fastfail mechanism. In Windows 8
5252 // and later, this will terminate the process immediately without running any
5353 // in-process exception handlers. In earlier versions of Windows, this
@@ -59,7 +59,18 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
5959 //
6060 // Note: this is the same implementation as in libstd's `abort_internal`
6161 unsafe fn abort( ) -> ! {
62- llvm_asm!( "int $$0x29" :: "{ecx}" ( 7 ) :: : volatile) ; // 7 is FAST_FAIL_FATAL_APP_EXIT
62+ const FAST_FAIL_FATAL_APP_EXIT : usize = 7 ;
63+ cfg_if:: cfg_if! {
64+ if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
65+ asm!( "int $$0x29" , in( "ecx" ) FAST_FAIL_FATAL_APP_EXIT ) ;
66+ } else if #[ cfg( all( target_arch = "arm" , target_feature = "thumb-mode" ) ) ] {
67+ asm!( ".inst 0xDEFB" , in( "r0" ) FAST_FAIL_FATAL_APP_EXIT ) ;
68+ } else if #[ cfg( target_arch = "aarch64" ) ] {
69+ asm!( "brk 0xF003" , in( "x0" ) FAST_FAIL_FATAL_APP_EXIT ) ;
70+ } else {
71+ core:: intrinsics:: abort( ) ;
72+ }
73+ }
6374 core:: intrinsics:: unreachable( ) ;
6475 }
6576 } else {
0 commit comments