@@ -217,6 +217,24 @@ pub unsafe fn free_ctx(ctx: *mut HookContext) {
217217) ) ]
218218const FPSIMD_MAGIC : u32 = 0x4650_8001 ;
219219
220+ #[ cfg( all(
221+ any( target_os = "linux" , target_os = "android" ) ,
222+ target_arch = "aarch64"
223+ ) ) ]
224+ #[ repr( C ) ]
225+ #[ derive( Copy , Clone ) ]
226+ struct LinuxAarch64Reserved {
227+ bytes : [ u8 ; 4096 ] ,
228+ }
229+
230+ #[ cfg( all(
231+ any( target_os = "linux" , target_os = "android" ) ,
232+ target_arch = "aarch64"
233+ ) ) ]
234+ #[ repr( C , align( 16 ) ) ]
235+ #[ derive( Copy , Clone ) ]
236+ struct LinuxAarch64AlignedReserved ( LinuxAarch64Reserved ) ;
237+
220238#[ cfg( all(
221239 any( target_os = "linux" , target_os = "android" ) ,
222240 target_arch = "aarch64"
@@ -229,7 +247,7 @@ struct LinuxAarch64MContext {
229247 sp : u64 ,
230248 pc : u64 ,
231249 pstate : u64 ,
232- reserved : [ u64 ; 512 ] ,
250+ reserved : LinuxAarch64AlignedReserved ,
233251}
234252
235253#[ cfg( all(
@@ -271,9 +289,9 @@ unsafe fn linux_aarch64_mcontext(uc: *mut libc::ucontext_t) -> *mut LinuxAarch64
271289unsafe fn linux_aarch64_fpsimd_context (
272290 mcontext : * mut LinuxAarch64MContext ,
273291) -> Option < * mut LinuxAarch64FpsimdContext > {
274- let reserved = unsafe { & mut ( * mcontext) . reserved } ;
275- let base = reserved. as_mut_ptr ( ) . cast :: < u8 > ( ) ;
276- let len = std :: mem :: size_of_val ( reserved) ;
292+ let reserved = unsafe { & mut ( * mcontext) . reserved . 0 . bytes } ;
293+ let base = reserved. as_mut_ptr ( ) ;
294+ let len = reserved. len ( ) ;
277295 let mut offset = 0usize ;
278296
279297 while offset + std:: mem:: size_of :: < LinuxAarch64CtxHeader > ( ) <= len {
0 commit comments