#![cfg(feature = "instructions")]
pub mod interrupts;
pub mod port;
pub mod random;
pub mod segmentation;
pub mod tables;
pub mod tlb;
#[inline]
pub fn hlt() {
unsafe {
#[cfg(feature = "inline_asm")]
asm!("hlt", options(nomem, nostack, preserves_flags));
#[cfg(not(feature = "inline_asm"))]
crate::asm::x86_64_asm_hlt();
}
}
#[inline]
pub fn nop() {
unsafe {
#[cfg(feature = "inline_asm")]
asm!("nop", options(nomem, nostack, preserves_flags));
#[cfg(not(feature = "inline_asm"))]
crate::asm::x86_64_asm_nop();
}
}
#[inline]
pub fn bochs_breakpoint() {
unsafe {
#[cfg(feature = "inline_asm")]
asm!("xchg bx, bx", options(nomem, nostack, preserves_flags));
#[cfg(not(feature = "inline_asm"))]
crate::asm::x86_64_asm_bochs();
}
}
#[cfg(feature = "inline_asm")]
#[cfg_attr(
feature = "doc_cfg",
doc(cfg(any(feature = "nightly", feature = "inline_asm")))
)]
#[inline(always)]
pub fn read_rip() -> crate::VirtAddr {
let rip: u64;
unsafe {
asm!("lea {}, [rip]", out(reg) rip, options(nostack, nomem, preserves_flags));
}
crate::VirtAddr::new(rip)
}