aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/mod.rs
blob: 38b08b1ab50ce6661d1f2e2ac4b38e52533c3f25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
pub mod arch_regs;
pub mod interrupt;
pub mod io_port;
pub mod mem;
pub mod misc;
pub mod paging;
use core::arch::asm;

pub const RFLAGS_IF_MASK: u64 = 1 << 9;
#[inline]
pub fn read_rflags() -> u64 {
	let rflags;
	unsafe {
		asm!("pushfq; popq {}", out(reg) rflags);
	}
	rflags
}

pub fn is_int_enabled() -> bool {
	let rf = read_rflags();
	return (rf & RFLAGS_IF_MASK) != 0;
}