1 /* Public domain. */ 2 3 #ifndef _LINUX_PREEMPT_H 4 #define _LINUX_PREEMPT_H 5 6 #include <asm/preempt.h> 7 #include <sys/param.h> /* for curcpu in machine/cpu.h */ 8 9 static inline void 10 preempt_enable(void) 11 { 12 } 13 14 static inline void 15 preempt_disable(void) 16 { 17 } 18 19 static inline void 20 migrate_enable(void) 21 { 22 } 23 24 static inline void 25 migrate_disable(void) 26 { 27 } 28 29 static inline bool 30 in_irq(void) 31 { 32 #if defined(__amd64__) || defined(__arm__) || defined(__arm64__) || \ 33 defined(__i386__) || defined(__powerpc64__) || defined(__riscv64__) 34 return (curcpu()->ci_idepth > 0); 35 #else 36 return false; 37 #endif 38 } 39 40 static inline bool 41 in_interrupt(void) 42 { 43 return in_irq(); 44 } 45 46 static inline bool 47 in_task(void) 48 { 49 return !in_irq(); 50 } 51 52 static inline bool 53 in_atomic(void) 54 { 55 return false; 56 } 57 58 #endif 59