File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
8
8
## [ Unreleased]
9
9
10
+ ### Added
11
+
12
+ - ` r3_port_std ` 's POSIX backend now supports AArch64.
13
+
10
14
### Fixed
11
15
12
16
- Fixed: Wrap const generic arguments in braces, fixing builds on the latest compiler version
Original file line number Diff line number Diff line change @@ -376,6 +376,53 @@ fn catch_longjmp<F: FnOnce(JmpBuf)>(cb: F) {
376
376
lateout( "r15" ) _,
377
377
) ;
378
378
}
379
+
380
+ #[ cfg( target_arch = "aarch64" ) ]
381
+ ( ) => {
382
+ asm ! (
383
+ "
384
+ # push context
385
+ adr x2, 0f
386
+ str x2, [sp, #-32]!
387
+ stp x29, x30, [sp, #16]
388
+
389
+ # do f(ctx, jmp_buf)
390
+ # [rdi = ctx, rsp = jmp_buf]
391
+ mov x1, sp
392
+ blr {f}
393
+
394
+ b 1f
395
+ 0:
396
+ # longjmp called. restore context
397
+ ldp x29, x30, [sp, #16]
398
+
399
+ 1:
400
+ # discard context
401
+ add sp, sp, #32
402
+ " ,
403
+ f = inlateout( reg) f => _,
404
+ inlateout( "x0" ) ctx => _,
405
+ // AArch64 callee-saved registers
406
+ lateout( "x19" ) _,
407
+ lateout( "x20" ) _,
408
+ lateout( "x21" ) _,
409
+ lateout( "x22" ) _,
410
+ lateout( "x23" ) _,
411
+ lateout( "x24" ) _,
412
+ lateout( "x25" ) _,
413
+ lateout( "x26" ) _,
414
+ lateout( "x27" ) _,
415
+ lateout( "x28" ) _,
416
+ lateout( "d8" ) _,
417
+ lateout( "d9" ) _,
418
+ lateout( "d10" ) _,
419
+ lateout( "d11" ) _,
420
+ lateout( "d12" ) _,
421
+ lateout( "d13" ) _,
422
+ lateout( "d14" ) _,
423
+ lateout( "d15" ) _,
424
+ ) ;
425
+ }
379
426
}
380
427
}
381
428
}
@@ -417,6 +464,19 @@ unsafe fn longjmp(jmp_buf: JmpBuf) -> ! {
417
464
options( noreturn) ,
418
465
) ;
419
466
}
467
+
468
+ #[ cfg( target_arch = "aarch64" ) ]
469
+ ( ) => {
470
+ asm ! (
471
+ "
472
+ mov sp, {}
473
+ ldr x0, [sp, #0]
474
+ br x0
475
+ " ,
476
+ in( reg) jmp_buf. sp. as_ptr( ) ,
477
+ options( noreturn) ,
478
+ ) ;
479
+ }
420
480
}
421
481
}
422
482
}
You can’t perform that action at this time.
0 commit comments