Skip to content

Commit

Permalink
Merge pull request #206 from toku-sa-n/add_enable_and_hlt
Browse files Browse the repository at this point in the history
Rename `enable_interrupts_and_hlt` to `enable_and_hlt`
  • Loading branch information
phil-opp authored Nov 11, 2020
2 parents 7def2db + c8b4c3d commit 7986d1f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/instructions/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ where
/// x86_64::instructions::hlt(); // wait for the next interrupt
/// }
///
/// // avoid this race by using `enable_interrupts_and_hlt`:
/// // avoid this race by using `enable_and_hlt`:
///
/// x86_64::instructions::interrupts::disable();
/// if nothing_to_do() {
/// // <- no interrupts can occur here (interrupts are disabled)
/// x86_64::instructions::interrupts::enable_interrupts_and_hlt();
/// x86_64::instructions::interrupts::enable_and_hlt();
/// }
///
/// ```
Expand All @@ -128,7 +128,7 @@ where
/// See <http://lkml.iu.edu/hypermail/linux/kernel/1009.2/01406.html> for more
/// information.
#[inline]
pub fn enable_interrupts_and_hlt() {
pub fn enable_and_hlt() {
#[cfg(feature = "inline_asm")]
unsafe {
asm!("sti; hlt", options(nomem, nostack));
Expand All @@ -139,6 +139,13 @@ pub fn enable_interrupts_and_hlt() {
}
}

/// Alias for [`enable_and_hlt`][enable_and_hlt] for backwards compatibility.
#[inline]
#[deprecated(note = "Use enable_and_hlt instead")]
pub fn enable_interrupts_and_hlt() {
enable_and_hlt();
}

/// Cause a breakpoint exception by invoking the `int3` instruction.
#[inline]
pub fn int3() {
Expand Down

0 comments on commit 7986d1f

Please sign in to comment.