switch_to.h 923 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_CSKY_SWITCH_TO_H
  3. #define __ASM_CSKY_SWITCH_TO_H
  4. #include <linux/thread_info.h>
  5. #ifdef CONFIG_CPU_HAS_FPU
  6. #include <abi/fpu.h>
  7. static inline void __switch_to_fpu(struct task_struct *prev,
  8. struct task_struct *next)
  9. {
  10. save_to_user_fp(&prev->thread.user_fp);
  11. restore_from_user_fp(&next->thread.user_fp);
  12. }
  13. #else
  14. static inline void __switch_to_fpu(struct task_struct *prev,
  15. struct task_struct *next)
  16. {}
  17. #endif
  18. /*
  19. * Context switching is now performed out-of-line in switch_to.S
  20. */
  21. extern struct task_struct *__switch_to(struct task_struct *,
  22. struct task_struct *);
  23. #define switch_to(prev, next, last) \
  24. do { \
  25. struct task_struct *__prev = (prev); \
  26. struct task_struct *__next = (next); \
  27. __switch_to_fpu(__prev, __next); \
  28. ((last) = __switch_to((prev), (next))); \
  29. } while (0)
  30. #endif /* __ASM_CSKY_SWITCH_TO_H */