rustubs/arch/
x86_64.rs

1pub mod arch_regs;
2pub mod gdt;
3pub mod interrupt;
4pub mod io_port;
5pub mod misc;
6pub mod paging;
7use core::arch::asm;
8
9pub const RFLAGS_IF_MASK: u64 = 1 << 9;
10
11pub mod ExternSyms {
12	extern "C" {
13		pub fn vectors_start();
14		pub fn idt();
15		pub fn idt_descr();
16	}
17}
18
19#[inline]
20pub fn read_rflags() -> u64 {
21	let rflags;
22	unsafe { asm!("pushfq; pop {}", out(reg) rflags) };
23	rflags
24}
25
26pub fn is_int_enabled() -> bool {
27	let rf = read_rflags();
28	(rf & RFLAGS_IF_MASK) != 0
29}