136fd0130Shoumkh use core::arch::asm; 266f67c6aSlogin 366f67c6aSlogin #[inline] local_irq_save() -> usize436fd0130Shoumkhpub fn local_irq_save() -> usize { 536fd0130Shoumkh let x: usize; 6*40fe15e0SLoGin // x86_64::registers::rflags:: 766f67c6aSlogin unsafe { 8*40fe15e0SLoGin asm!("pushfq; pop {}; cli", out(reg) x, options(nomem, preserves_flags)); 966f67c6aSlogin } 1036fd0130Shoumkh x 1166f67c6aSlogin } 1266f67c6aSlogin 1366f67c6aSlogin #[inline] 1436fd0130Shoumkh // 恢复先前保存的rflags的值x local_irq_restore(x: usize)1536fd0130Shoumkhpub fn local_irq_restore(x: usize) { 1666f67c6aSlogin unsafe { 17*40fe15e0SLoGin asm!("push {}; popfq", in(reg) x, options(nomem, preserves_flags)); 1866f67c6aSlogin } 1966f67c6aSlogin } 20