6 #include <klibc/compiler.h>
8 #if __SIZEOF_POINTER__ == 4
10 #elif __SIZEOF_POINTER__ == 8
11 #include <x86_64/cpu.h>
13 #error "unsupported architecture"
16 typedef unsigned long irq_state_t
;
18 static inline irq_state_t
irq_state(void)
22 asm volatile("pushf ; pop %0" : "=rm" (__st
) : : "memory");
26 static inline irq_state_t
irq_save(void)
28 irq_state_t __st
= irq_state();
33 static inline void irq_restore(irq_state_t __st
)
35 asm volatile("push %0 ; popf" : : "rm" (__st
) : "memory");
38 /* Standard macro to see if a specific flag is changeable */
39 static inline __constfunc
bool cpu_has_eflag(unsigned long flag
)
52 : "=&r" (f0
), "=&r" (f1
)
54 return !!((f0
^f1
) & flag
);