@@ -12,8 +12,11 @@ unsafe fn getrandom_syscall(buf: *mut u8, buflen: usize, flags: u32) -> isize {
1212
1313 // Based on `rustix` and `linux-raw-sys` code.
1414 cfg_if ! {
15- if #[ cfg( target_arch = "arm" ) ] {
16- // TODO(MSRV-1.78): Also check `target_abi = "eabi"`.
15+ if #[ cfg( all(
16+ target_arch = "arm" ,
17+ any( target_abi = "eabi" , target_abi = "eabihf" ) ,
18+ ) ) ] {
19+ const __NR_getrandom: u32 = 384 ;
1720 // In thumb-mode, r7 is the frame pointer and is not permitted to be used in
1821 // an inline asm operand, so we have to use a different register and copy it
1922 // into r7 inside the inline asm.
@@ -23,19 +26,21 @@ unsafe fn getrandom_syscall(buf: *mut u8, buflen: usize, flags: u32) -> isize {
2326 unsafe {
2427 core:: arch:: asm!(
2528 "mov {tmp}, r7" ,
26- // TODO(MSRV-1.82): replace with `nr = const __NR_getrandom,`
27- "mov r7, #384" ,
29+ "mov r7, {nr}" ,
2830 "svc 0" ,
2931 "mov r7, {tmp}" ,
3032 tmp = out( reg) _,
33+ nr = const __NR_getrandom,
3134 inlateout( "r0" ) buf => r0,
3235 in( "r1" ) buflen,
3336 in( "r2" ) flags,
3437 options( nostack, preserves_flags)
3538 ) ;
3639 }
37- } else if #[ cfg( target_arch = "aarch64" ) ] {
38- // TODO(MSRV-1.78): Also check `any(target_abi = "", target_abi = "ilp32")` above.
40+ } else if #[ cfg( all(
41+ target_arch = "aarch64" ,
42+ any( target_abi = "" , target_abi = "ilp32" ) ,
43+ ) ) ] {
3944 // According to the ILP32 patch for the kernel that hasn't yet
4045 // been merged into the mainline, "AARCH64/ILP32 ABI uses standard
4146 // syscall table [...] with the exceptions listed below," where
@@ -51,8 +56,10 @@ unsafe fn getrandom_syscall(buf: *mut u8, buflen: usize, flags: u32) -> isize {
5156 options( nostack, preserves_flags)
5257 ) ;
5358 }
54- } else if #[ cfg( target_arch = "loongarch64" ) ] {
55- // TODO(MSRV-1.78): Also check `any(target_abi = "", target_abi = "ilp32")` above.
59+ } else if #[ cfg( all(
60+ target_arch = "loongarch64" ,
61+ any( target_abi = "" , target_abi = "ilp32" ) ,
62+ ) ) ] {
5663 const __NR_getrandom: u32 = 278 ;
5764 unsafe {
5865 core:: arch:: asm!(
@@ -104,8 +111,10 @@ unsafe fn getrandom_syscall(buf: *mut u8, buflen: usize, flags: u32) -> isize {
104111 options( nostack, preserves_flags)
105112 ) ;
106113 }
107- } else if #[ cfg( target_arch = "x86_64" ) ] {
108- // TODO(MSRV-1.78): Add `any(target_abi = "", target_abi = "x32")` above.
114+ } else if #[ cfg( all(
115+ target_arch = "x86_64" ,
116+ any( target_abi = "" , target_abi = "x32" ) ,
117+ ) ) ] {
109118 const __X32_SYSCALL_BIT: u32 = 0x40000000 ;
110119 const OFFSET : u32 = if cfg!( target_pointer_width = "32" ) { __X32_SYSCALL_BIT } else { 0 } ;
111120 const __NR_getrandom: u32 = OFFSET + 318 ;
0 commit comments