rust-embedded / rust-embedded/aarch32
Should register `fn modify` be unsafe?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 66
- Forks
- 25
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 4
Description
The system registers have associated functions which do a read-modify-write cycle, but the functions are not unsafe to call and do not require the (unsafe) creation of an object that represents unique ownership of that register. This means safe code can have undefined behaviour, through the main thread doing a modify on a register, which is interrupted by an exception that also does a modify on the same register. That's not ideal.
Rather than model each register as an object with a unique owner, I think the modify function should be unsafe.
I think the read and write functions can remain safe, because the effect would be no worse than conflicting store operations on an atomic variable (which is safe).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by locating the system-register associated functions and their modify, read, and write entry points. Review the seven-comment discussion and the register-safety model before changing the API. Done means the safety of modify matches the agreed ownership and interruption behavior while read and write retain their intended status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100