Skip to content

Commit bdf59cc

Browse files
bors[bot]tfx2001
andauthored
Merge #121
121: fix critial section implementation r=dkhayes117 a=tfx2001 It should be `0b1000` rather than `0b100`. `Bit 2` is a reserved bit, and `Bit 3` is `MIE` that needs to be cleared. ![image](https://user-images.githubusercontent.com/19427212/212855746-7df197f1-5582-4844-a58e-6c7269d03b22.png) Co-authored-by: tfx2001 <[email protected]>
2 parents 9ba9421 + 5dafe25 commit bdf59cc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fix implementation for `SingleHartCriticalSection`
13+
1014
## [v0.10.0] - 2022-11-09
1115

1216
### Added

src/critical_section.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set_impl!(SingleHartCriticalSection);
99
unsafe impl Impl for SingleHartCriticalSection {
1010
unsafe fn acquire() -> RawRestoreState {
1111
let mut mstatus: usize;
12-
core::arch::asm!("csrrci {}, 0x300, 0b100", out(reg) mstatus);
12+
core::arch::asm!("csrrci {}, mstatus, 0b1000", out(reg) mstatus);
1313
core::mem::transmute::<_, mstatus::Mstatus>(mstatus).mie()
1414
}
1515

0 commit comments

Comments
 (0)