xref: /DragonOS/kernel/src/arch/x86_64/include/asm/irqflags.h (revision fae6e9ade46a52976ad5d099643d51cc20876448)
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