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

cortex-m: Add missing ISB after CONTROL writes #1863

Merged
merged 1 commit into from May 28, 2020
Merged

Conversation

ppannuto
Copy link
Member

Pull Request Overview

According to the ARM ARM, an instruction synchronization barrier is
requried after switching processor priviledge state:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHFJCAC.html

In practice, most Cortex-M's have tiny instruction caches, so this hasn't
bitten us yet, but we should still do the right thing in case this becomes
an issue in the future.

Testing Strategy

Compiling.

TODO or Help Wanted

Need to test on HW.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make format.
  • Fixed errors surfaced by make clippy.

According to the ARM ARM, an instruction synchronization barrier is
requried after switching processor priviledge state:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHFJCAC.html

In practice, most Cortex-M's have tiny instruction caches, so this hasn't
bitten us yet, but we should still do the right thing in case this becomes
an issue in the future.
Copy link
Contributor

@bradjc bradjc left a comment

Choose a reason for hiding this comment

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

In the Cortex-M processors, the omission of the ISB after writing to the CONTROL register does not cause a program error, apart from the issue that instructions could have been pre-fetched using the previous privilege level. The ISB instruction is only required if it is necessary to have the subsequent instructions fetched with the correct privilege level.

@bradjc
Copy link
Contributor

bradjc commented May 28, 2020

bors r+

@bors bors bot merged commit 2983dd2 into master May 28, 2020
@bors bors bot deleted the missing-msr-isb branch May 28, 2020 13:57
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.

None yet

4 participants