Merge tag 'locking-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / csky / include / asm / switch_to.h
blob35a39e88933da6836967cfdfcffd5184237644e3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_SWITCH_TO_H
5 #define __ASM_CSKY_SWITCH_TO_H
7 #include <linux/thread_info.h>
8 #ifdef CONFIG_CPU_HAS_FPU
9 #include <abi/fpu.h>
10 static inline void __switch_to_fpu(struct task_struct *prev,
11 struct task_struct *next)
13 save_to_user_fp(&prev->thread.user_fp);
14 restore_from_user_fp(&next->thread.user_fp);
16 #else
17 static inline void __switch_to_fpu(struct task_struct *prev,
18 struct task_struct *next)
20 #endif
23 * Context switching is now performed out-of-line in switch_to.S
25 extern struct task_struct *__switch_to(struct task_struct *,
26 struct task_struct *);
28 #define switch_to(prev, next, last) \
29 do { \
30 struct task_struct *__prev = (prev); \
31 struct task_struct *__next = (next); \
32 __switch_to_fpu(__prev, __next); \
33 ((last) = __switch_to((prev), (next))); \
34 } while (0)
36 #endif /* __ASM_CSKY_SWITCH_TO_H */