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

asm: set unsafety of nop and delay functions to safe #141

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

luojia65
Copy link
Contributor

@luojia65 luojia65 commented Sep 5, 2023

The NOP instruction does not change architecturally visible state, including operations that would break memory safety boundaries; thus nop instruction wrapper should be safe to call. The delay function uses ADDI and BNE instructions which would form a function internal loop, which is safe under Rust constraints.

This pull request also includes an explanation on NOP instruction under Rust docs, and a small codestyle fix in Cargo.toml file.

I modified internal macro instruction to allow wrapping instruction with safe functions. If it's inappropriate, please reply and I'll change to other ways of implementation.

@luojia65 luojia65 requested a review from a team as a code owner September 5, 2023 06:41
... and a small codestyle fix in Cargo.toml file.

Signed-off-by: Zhouqi Jiang <[email protected]>
Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'll leave a couple of days for more experienced folks of the @rust-embedded/risc-v team to review it before merging it. Thanks!

@romancardenas romancardenas added this pull request to the merge queue Sep 14, 2023
Merged via the queue into rust-embedded:master with commit a38fb8d Sep 14, 2023
43 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.

2 participants