xref: /DragonOS/kernel/src/arch/x86_64/include/asm/irqflags.h (revision f5b2038871d3441e1c7f32439ff422957e7ab828)
1 #pragma once
2 #include <asm/asm.h>
3 // 保存当前rflags的值到变量x内并关闭中断
4 #define local_irq_save(x) __asm__ __volatile__("pushfq ; popq %0 ; cli" \
5                                                : "=g"(x)::"memory")
6 // 恢复先前保存的rflags的值x
7 #define local_irq_restore(x) __asm__ __volatile__("pushq %0 ; popfq" ::"g"(x) \
8                                                   : "memory")
9 #define local_irq_disable() cli();
10 #define local_irq_enable() sti();
11