Skip to content

fix: read ICSR volatile in SCB::vect_active()#664

Open
jakobjung10 wants to merge 1 commit into
rust-embedded:masterfrom
jakobjung10:fix-vect-active-volatile-icsr
Open

fix: read ICSR volatile in SCB::vect_active()#664
jakobjung10 wants to merge 1 commit into
rust-embedded:masterfrom
jakobjung10:fix-vect-active-volatile-icsr

Conversation

@jakobjung10

Copy link
Copy Markdown

SCB::vect_active() now reads ICSR with a volatile access, preventing the load from being narrowed to a byte read that faults on word-only ICSR models.

`SCB::vect_active()` now reads ICSR with a volatile access, preventing the load from being narrowed to a byte read that faults on word-only ICSR models.
@jonathanpallant

Copy link
Copy Markdown
Contributor

That's a plain read not a volatile read?

@jakobjung10

Copy link
Copy Markdown
Author

read() in (*SCB::PTR).icsr.read() internally calls self.register.get() from volatile-register, which again internally calls ptr::read_volatile(self.value.get()) from vcell.
Therefore, it is a volatile read.

Also, calling read() aligns more with the remaining scb module, as the direct call of ptr::read(&(*SCB::PTR).icsr as *const _ as *const u32) is actually the outlier.

@jonathanpallant

Copy link
Copy Markdown
Contributor

oof, fair point - my mistake!

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