File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -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
+ llvm_asm!( "int $$0x29" :: "{ecx}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
66
+ } else if #[ cfg( target_arch = "arm" ) ] {
67
+ llvm_asm!( ".inst 0xDEFB" :: "{r0}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
68
+ } else if #[ cfg( target_arch = "aarch64" ) ] {
69
+ llvm_asm!( ".inst 0xF003" :: "{x0}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
70
+ } else {
71
+ core:: intrinsics:: abort( ) ;
72
+ }
73
+ }
63
74
core:: intrinsics:: unreachable( ) ;
64
75
}
65
76
} else {
Original file line number Diff line number Diff line change @@ -306,10 +306,20 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
306
306
/// that function for more information on `__fastfail`
307
307
#[ allow( unreachable_code) ]
308
308
pub fn abort_internal ( ) -> ! {
309
- # [ cfg ( any ( target_arch = "x86" , target_arch = "x86_64" ) ) ]
309
+ const FAST_FAIL_FATAL_APP_EXIT : usize = 7 ;
310
310
unsafe {
311
- llvm_asm ! ( "int $$0x29" :: "{ecx}" ( 7 ) :: : volatile) ; // 7 is FAST_FAIL_FATAL_APP_EXIT
312
- crate :: intrinsics:: unreachable ( ) ;
311
+ cfg_if:: cfg_if! {
312
+ if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
313
+ llvm_asm!( "int $$0x29" :: "{ecx}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
314
+ crate :: intrinsics:: unreachable( ) ;
315
+ } else if #[ cfg( target_arch = "arm" ) ] {
316
+ llvm_asm!( ".inst 0xDEFB" :: "{r0}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
317
+ crate :: intrinsics:: unreachable( ) ;
318
+ } else if #[ cfg( target_arch = "aarch64" ) ] {
319
+ llvm_asm!( ".inst 0xF003" :: "{x0}" ( FAST_FAIL_FATAL_APP_EXIT ) :: : volatile) ;
320
+ crate :: intrinsics:: unreachable( ) ;
321
+ }
322
+ }
313
323
}
314
324
crate :: intrinsics:: abort ( ) ;
315
325
}
You can’t perform that action at this time.
0 commit comments