Skip to content

Rename enable_interrupts_and_hlt to enable_and_hlt #206

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

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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