Skip to content

Commit 798037d

Browse files
committed
Fixup comments in asm handlers
1 parent 6876649 commit 798037d

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

cortex-a-rt/src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ core::arch::global_asm!(
447447
_asm_default_undefined_handler:
448448
// state save from compiled code
449449
srsfd sp!, {und_mode}
450-
// to work out what mode we're in, we need R0
450+
// to work out what mode we're in, we need R0, so save it
451451
push {{r0}}
452452
// First adjust LR for two purposes: Passing the faulting instruction to the C handler,
453453
// and to return to the failing instruction after the C handler returns.
@@ -459,7 +459,7 @@ core::arch::global_asm!(
459459
ite eq
460460
subeq lr, lr, #4
461461
subne lr, lr, #2
462-
// now do our standard exception save
462+
// now do our standard exception save (which saves the 'wrong' R0)
463463
"#,
464464
save_context!(),
465465
r#"
@@ -469,15 +469,15 @@ core::arch::global_asm!(
469469
bl _undefined_handler
470470
// if we get back here, assume they returned a new LR in r0
471471
mov lr, r0
472-
// do our standard restore
472+
// do our standard restore (with the 'wrong' R0)
473473
"#,
474474
restore_context!(),
475475
r#"
476-
// get our real saved R0
476+
// get the R0 we saved early
477477
pop {{r0}}
478-
// overwrite the saved LR with the adjusted one
478+
// overwrite the saved LR with the one from the C handler
479479
str lr, [sp]
480-
// Return to the failing instruction which is the recommended approach by ARM.
480+
// Return from the asm handler
481481
rfefd sp!
482482
.size _asm_default_undefined_handler, . - _asm_default_undefined_handler
483483
@@ -533,9 +533,9 @@ core::arch::global_asm!(
533533
"#,
534534
restore_context!(),
535535
r#"
536-
// overwrite the saved LR with the adjusted one
536+
// overwrite the saved LR with the one from the C handler
537537
str lr, [sp]
538-
// Return to the failing instruction which is the recommended approach by ARM.
538+
// Return from the asm handler
539539
rfefd sp!
540540
.size _asm_default_abort_handler, . - _asm_default_abort_handler
541541
@@ -564,9 +564,9 @@ core::arch::global_asm!(
564564
"#,
565565
restore_context!(),
566566
r#"
567-
// overwrite the saved LR with the adjusted one
567+
// overwrite the saved LR with the one from the C handler
568568
str lr, [sp]
569-
// Return to the failing instruction which is the recommended approach by ARM.
569+
// Return from the asm handler
570570
rfefd sp!
571571
.size _asm_default_prefetch_handler, . - _asm_default_prefetch_handler
572572

cortex-r-rt/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,15 @@ core::arch::global_asm!(
419419
bl _undefined_handler
420420
// if we get back here, assume they returned a new LR in r0
421421
mov lr, r0
422-
// do our standard restore
422+
// do our standard restore (with the 'wrong' R0)
423423
"#,
424424
restore_context!(),
425425
r#"
426-
// get our real saved R0
426+
// get the R0 we saved early
427427
pop {{r0}}
428-
// overwrite the saved LR with the adjusted one
428+
// overwrite the saved LR with the one from the C handler
429429
str lr, [sp]
430-
// Return to the failing instruction which is the recommended approach by ARM.
430+
// Return from the asm handler
431431
rfefd sp!
432432
.size _asm_default_undefined_handler, . - _asm_default_undefined_handler
433433
@@ -483,9 +483,9 @@ core::arch::global_asm!(
483483
"#,
484484
restore_context!(),
485485
r#"
486-
// overwrite the saved LR with the adjusted one
486+
// overwrite the saved LR with the one from the C handler
487487
str lr, [sp]
488-
// Return to the failing instruction which is the recommended approach by ARM.
488+
// Return from the asm handler
489489
rfefd sp!
490490
.size _asm_default_abort_handler, . - _asm_default_abort_handler
491491
@@ -514,9 +514,9 @@ core::arch::global_asm!(
514514
"#,
515515
restore_context!(),
516516
r#"
517-
// overwrite the saved LR with the adjusted one
517+
// overwrite the saved LR with the one from the C handler
518518
str lr, [sp]
519-
// Return to the failing instruction which is the recommended approach by ARM.
519+
// Return from the asm handler
520520
rfefd sp!
521521
.size _asm_default_prefetch_handler, . - _asm_default_prefetch_handler
522522

0 commit comments

Comments
 (0)