Skip to content

Commit e451dc3

Browse files
committed
Added safety comment to write_raw()
1 parent 8279b63 commit e451dc3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cortex-m/src/register/primask.rs

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ pub fn read_raw() -> u32 {
5151

5252
/// Writes the entire PRIMASK register
5353
/// Note that bits [31:1] are reserved and SBZP (Should-Be-Zero-or-Preserved)
54+
///
55+
/// # Safety
56+
///
57+
/// This method is unsafe as other unsafe code may rely on interrupts remaining disabled, for
58+
/// example during a critical section, and being able to safely re-enable them would lead to
59+
/// undefined behaviour. Do not call this function in a context where interrupts are expected to
60+
/// remain disabled -- for example, in the midst of a critical section or `interrupt::free()` call.
5461
#[cfg(cortex_m)]
5562
#[inline]
5663
pub unsafe fn write_raw(r: u32) {

0 commit comments

Comments
 (0)