17
17
#![ feature( panic_runtime) ]
18
18
#![ feature( staged_api) ]
19
19
#![ feature( rustc_attrs) ]
20
- #![ feature( llvm_asm ) ]
20
+ #![ feature( asm ) ]
21
21
22
22
use core:: any:: Any ;
23
23
@@ -47,7 +47,7 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
47
47
}
48
48
__rust_abort( ) ;
49
49
}
50
- } else if #[ cfg( all ( windows, any ( target_arch = "x86" , target_arch = "x86_64" ) ) ) ] {
50
+ } else if #[ cfg( windows) ] {
51
51
// On Windows, use the processor-specific __fastfail mechanism. In Windows 8
52
52
// and later, this will terminate the process immediately without running any
53
53
// 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 {
59
59
//
60
60
// Note: this is the same implementation as in libstd's `abort_internal`
61
61
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( target_arch = "arm" ) ] {
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
+ }
63
74
core:: intrinsics:: unreachable( ) ;
64
75
}
65
76
} else {
0 commit comments