.. | .. |
---|
35 | 35 | return flags; |
---|
36 | 36 | } |
---|
37 | 37 | |
---|
| 38 | +static inline unsigned long native_save_flags(void) |
---|
| 39 | +{ |
---|
| 40 | + return native_save_fl(); |
---|
| 41 | +} |
---|
| 42 | + |
---|
38 | 43 | extern inline void native_restore_fl(unsigned long flags); |
---|
39 | | -extern inline void native_restore_fl(unsigned long flags) |
---|
| 44 | +extern __always_inline void native_restore_fl(unsigned long flags) |
---|
40 | 45 | { |
---|
41 | 46 | asm volatile("push %0 ; popf" |
---|
42 | 47 | : /* no output */ |
---|
.. | .. |
---|
52 | 57 | static __always_inline void native_irq_enable(void) |
---|
53 | 58 | { |
---|
54 | 59 | asm volatile("sti": : :"memory"); |
---|
| 60 | +} |
---|
| 61 | + |
---|
| 62 | +static __always_inline void native_irq_sync(void) |
---|
| 63 | +{ |
---|
| 64 | + asm volatile("sti ; nop ; cli": : :"memory"); |
---|
| 65 | +} |
---|
| 66 | + |
---|
| 67 | +static __always_inline unsigned long native_irq_save(void) |
---|
| 68 | +{ |
---|
| 69 | + unsigned long flags; |
---|
| 70 | + |
---|
| 71 | + flags = native_save_flags(); |
---|
| 72 | + |
---|
| 73 | + native_irq_disable(); |
---|
| 74 | + |
---|
| 75 | + return flags; |
---|
| 76 | +} |
---|
| 77 | + |
---|
| 78 | +static __always_inline void native_irq_restore(unsigned long flags) |
---|
| 79 | +{ |
---|
| 80 | + return native_restore_fl(flags); |
---|
| 81 | +} |
---|
| 82 | + |
---|
| 83 | +static __always_inline int native_irqs_disabled_flags(unsigned long flags) |
---|
| 84 | +{ |
---|
| 85 | + return !(flags & X86_EFLAGS_IF); |
---|
| 86 | +} |
---|
| 87 | + |
---|
| 88 | +static __always_inline bool native_irqs_disabled(void) |
---|
| 89 | +{ |
---|
| 90 | + unsigned long flags = native_save_flags(); |
---|
| 91 | + return native_irqs_disabled_flags(flags); |
---|
55 | 92 | } |
---|
56 | 93 | |
---|
57 | 94 | static inline __cpuidle void native_safe_halt(void) |
---|
.. | .. |
---|
73 | 110 | #else |
---|
74 | 111 | #ifndef __ASSEMBLY__ |
---|
75 | 112 | #include <linux/types.h> |
---|
76 | | - |
---|
77 | | -static __always_inline unsigned long arch_local_save_flags(void) |
---|
78 | | -{ |
---|
79 | | - return native_save_fl(); |
---|
80 | | -} |
---|
81 | | - |
---|
82 | | -static __always_inline void arch_local_irq_restore(unsigned long flags) |
---|
83 | | -{ |
---|
84 | | - native_restore_fl(flags); |
---|
85 | | -} |
---|
86 | | - |
---|
87 | | -static __always_inline void arch_local_irq_disable(void) |
---|
88 | | -{ |
---|
89 | | - native_irq_disable(); |
---|
90 | | -} |
---|
91 | | - |
---|
92 | | -static __always_inline void arch_local_irq_enable(void) |
---|
93 | | -{ |
---|
94 | | - native_irq_enable(); |
---|
95 | | -} |
---|
| 113 | +#include <asm/irq_pipeline.h> |
---|
96 | 114 | |
---|
97 | 115 | /* |
---|
98 | 116 | * Used in the idle loop; sti takes one instruction cycle |
---|
.. | .. |
---|
112 | 130 | native_halt(); |
---|
113 | 131 | } |
---|
114 | 132 | |
---|
115 | | -/* |
---|
116 | | - * For spinlocks, etc: |
---|
117 | | - */ |
---|
118 | | -static __always_inline unsigned long arch_local_irq_save(void) |
---|
119 | | -{ |
---|
120 | | - unsigned long flags = arch_local_save_flags(); |
---|
121 | | - arch_local_irq_disable(); |
---|
122 | | - return flags; |
---|
123 | | -} |
---|
124 | 133 | #else |
---|
125 | 134 | |
---|
126 | 135 | #define ENABLE_INTERRUPTS(x) sti |
---|
.. | .. |
---|
149 | 158 | #ifndef __ASSEMBLY__ |
---|
150 | 159 | static __always_inline int arch_irqs_disabled_flags(unsigned long flags) |
---|
151 | 160 | { |
---|
152 | | - return !(flags & X86_EFLAGS_IF); |
---|
| 161 | + return native_irqs_disabled_flags(flags); |
---|
153 | 162 | } |
---|
154 | 163 | |
---|
155 | 164 | static __always_inline int arch_irqs_disabled(void) |
---|