xref: /DragonOS/kernel/src/arch/x86_64/asm/irqflags.rs (revision 6cb769c423b09e88fea1763210200a716477be0a)
1 use core::arch::asm;
2 
3 #[inline]
4 pub fn local_irq_save(flags: &mut u64) {
5     unsafe {
6         asm!(
7             "pushfq",
8             "pop rax",
9             "mov rax, {0}",
10             "cli",
11             out(reg)(*flags),
12         );
13     }
14 }
15 
16 #[inline]
17 pub fn local_irq_restore(flags: &u64) {
18     let x = *flags;
19 
20     unsafe {
21         asm!("push r15",
22             "popfq", in("r15")(x));
23     }
24 }
25