Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv: align assembly functions with cortex-m #246

Merged
merged 1 commit into from
Dec 17, 2024
Merged

riscv: align assembly functions with cortex-m #246

merged 1 commit into from
Dec 17, 2024

Conversation

romancardenas
Copy link
Contributor

Closes #181

On instructions that trigger exceptions

I decided to keep instructions that trigger exceptions (e.g., ecall) unsafe for their potential side effects. For example, if no exception handler is defined, triggering an exception can cause the program to crash. Also, raising exceptions is a potential way to avoid critical sections. Thus, one must be careful with them.

In any case, I'm open to to discuss this in case anyone has a different point of view.

@romancardenas romancardenas requested a review from a team as a code owner December 7, 2024 16:59
riscv/src/asm.rs Show resolved Hide resolved
@rmsyn
Copy link
Contributor

rmsyn commented Dec 9, 2024

I decided to keep instructions that trigger exceptions (e.g., ecall) unsafe for their potential side effects. For example, if no exception handler is defined, triggering an exception can cause the program to crash.

I think this is the right decision, too. Even if there is an exception handler defined, it could be defined using unsafe Rust, C, or assembly. Inherently unsafe, since we can't guarantee at compile-time what exception-triggering code calls into.

@romancardenas romancardenas added this pull request to the merge queue Dec 17, 2024
Merged via the queue into master with commit 60800c1 Dec 17, 2024
101 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.

riscv: align assembly functions with cortex-m crate
2 participants