Skip to content

Clean up handler comments#201

Merged
jonathanpallant merged 1 commit into
rust-embedded:mainfrom
thejpster:tidy-up-asm-comments
Jul 6, 2026
Merged

Clean up handler comments#201
jonathanpallant merged 1 commit into
rust-embedded:mainfrom
thejpster:tidy-up-asm-comments

Conversation

@thejpster

Copy link
Copy Markdown
Contributor

I've tried to make sure every asm handler routine:

  1. Numbers all the steps it takes on entry
  2. Matches those numbered steps on exit
  3. Uses // Initial capital letter for the comments
  4. Has a consistent comment for any particular piece of assembly when used across handlers
  5. If you need to do an ldmfd sp! on exit (usually because that variant can restore SPSR to CPSR), use matching stmfd sp! on entry, even if a push would do the same thing - just for consistency and to make the pairing obvious.
  6. Removed references to chapters of the ARM ARM ARM, because the right ARM ARM ARM depends on which target you are building.

Also, doing a and r12, sp, 7 does it in one instruction whereas before I sometimes used two.

1. Numbers all the steps it takes on entry
2. Matches those numbered steps on exit
3. Uses `// Initial capital letter` for the comments
4. Has a consistent comment for any particular piece of assembly when used across handlers
5. If you need to do an `ldmfd sp!` on exit (usually because that variant can restore `SPSR` to `CPSR`), use matching `stmfd sp!` on entry, even if a `push` would do the same thing - just for consistency and to make the pairing obvious.
6. Removed references to chapters of the ARM ARM ARM, because the right ARM ARM ARM depends on which target you are building.
7. Talks about pushing and popping with the stack, or grabbing and restoring with MRS/MSR

Also, doing a `and r12, sp, 7` does it in one instruction whereas before I sometimes used two.
@thejpster thejpster force-pushed the tidy-up-asm-comments branch from 347953d to 6029b49 Compare July 5, 2026 13:07
@jonathanpallant jonathanpallant added this pull request to the merge queue Jul 6, 2026
Merged via the queue into rust-embedded:main with commit 8832a73 Jul 6, 2026
96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants