.. | .. |
---|
170 | 170 | static inline void arch_setup_new_exec(void) { } |
---|
171 | 171 | #endif |
---|
172 | 172 | |
---|
| 173 | +#ifdef ti_local_flags |
---|
| 174 | +/* |
---|
| 175 | + * If the arch defines a set of per-thread synchronous flags, provide |
---|
| 176 | + * generic accessors to them. |
---|
| 177 | + */ |
---|
| 178 | +static __always_inline |
---|
| 179 | +void set_ti_local_flags(struct thread_info *ti, unsigned int mask) |
---|
| 180 | +{ |
---|
| 181 | + ti_local_flags(ti) |= mask; |
---|
| 182 | +} |
---|
| 183 | + |
---|
| 184 | +static __always_inline void set_thread_local_flags(unsigned int mask) |
---|
| 185 | +{ |
---|
| 186 | + set_ti_local_flags(current_thread_info(), mask); |
---|
| 187 | +} |
---|
| 188 | + |
---|
| 189 | +static __always_inline |
---|
| 190 | +int test_and_set_ti_local_flags(struct thread_info *ti, unsigned int mask) |
---|
| 191 | +{ |
---|
| 192 | + int old = ti_local_flags(ti) & mask; |
---|
| 193 | + ti_local_flags(ti) |= mask; |
---|
| 194 | + return old != 0; |
---|
| 195 | +} |
---|
| 196 | + |
---|
| 197 | +static __always_inline int test_and_set_thread_local_flags(unsigned int mask) |
---|
| 198 | +{ |
---|
| 199 | + return test_and_set_ti_local_flags(current_thread_info(), mask); |
---|
| 200 | +} |
---|
| 201 | + |
---|
| 202 | +static __always_inline |
---|
| 203 | +void clear_ti_local_flags(struct thread_info *ti, unsigned int mask) |
---|
| 204 | +{ |
---|
| 205 | + ti_local_flags(ti) &= ~mask; |
---|
| 206 | +} |
---|
| 207 | + |
---|
| 208 | +static __always_inline |
---|
| 209 | +int test_and_clear_ti_local_flags(struct thread_info *ti, unsigned int mask) |
---|
| 210 | +{ |
---|
| 211 | + int old = ti_local_flags(ti) & mask; |
---|
| 212 | + ti_local_flags(ti) &= ~mask; |
---|
| 213 | + return old != 0; |
---|
| 214 | +} |
---|
| 215 | + |
---|
| 216 | +static __always_inline int test_and_clear_thread_local_flags(unsigned int mask) |
---|
| 217 | +{ |
---|
| 218 | + return test_and_clear_ti_local_flags(current_thread_info(), mask); |
---|
| 219 | +} |
---|
| 220 | + |
---|
| 221 | +static __always_inline void clear_thread_local_flags(unsigned int mask) |
---|
| 222 | +{ |
---|
| 223 | + clear_ti_local_flags(current_thread_info(), mask); |
---|
| 224 | +} |
---|
| 225 | + |
---|
| 226 | +static __always_inline |
---|
| 227 | +bool test_ti_local_flags(struct thread_info *ti, unsigned int mask) |
---|
| 228 | +{ |
---|
| 229 | + return (ti_local_flags(ti) & mask) != 0; |
---|
| 230 | +} |
---|
| 231 | + |
---|
| 232 | +static __always_inline bool test_thread_local_flags(unsigned int mask) |
---|
| 233 | +{ |
---|
| 234 | + return test_ti_local_flags(current_thread_info(), mask); |
---|
| 235 | +} |
---|
| 236 | + |
---|
| 237 | +#endif /* ti_local_flags */ |
---|
| 238 | + |
---|
173 | 239 | #endif /* __KERNEL__ */ |
---|
174 | 240 | |
---|
175 | 241 | #endif /* _LINUX_THREAD_INFO_H */ |
---|