Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef __ASM_CSKY_SWITCH_TO_H
0004 #define __ASM_CSKY_SWITCH_TO_H
0005 
0006 #include <linux/thread_info.h>
0007 #ifdef CONFIG_CPU_HAS_FPU
0008 #include <abi/fpu.h>
0009 static inline void __switch_to_fpu(struct task_struct *prev,
0010                    struct task_struct *next)
0011 {
0012     save_to_user_fp(&prev->thread.user_fp);
0013     restore_from_user_fp(&next->thread.user_fp);
0014 }
0015 #else
0016 static inline void __switch_to_fpu(struct task_struct *prev,
0017                    struct task_struct *next)
0018 {}
0019 #endif
0020 
0021 /*
0022  * Context switching is now performed out-of-line in switch_to.S
0023  */
0024 extern struct task_struct *__switch_to(struct task_struct *,
0025                        struct task_struct *);
0026 
0027 #define switch_to(prev, next, last)                 \
0028     do {                                \
0029         struct task_struct *__prev = (prev);            \
0030         struct task_struct *__next = (next);            \
0031         __switch_to_fpu(__prev, __next);            \
0032         ((last) = __switch_to((prev), (next)));         \
0033     } while (0)
0034 
0035 #endif /* __ASM_CSKY_SWITCH_TO_H */