switch_to.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _ASM_ARC_SWITCH_TO_H
  9. #define _ASM_ARC_SWITCH_TO_H
  10. #ifndef __ASSEMBLY__
  11. #include <linux/sched.h>
  12. #ifdef CONFIG_ARC_FPU_SAVE_RESTORE
  13. extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
  14. #define ARC_FPU_PREV(p, n) fpu_save_restore(p, n)
  15. #define ARC_FPU_NEXT(t)
  16. #else
  17. #define ARC_FPU_PREV(p, n)
  18. #define ARC_FPU_NEXT(n)
  19. #endif /* !CONFIG_ARC_FPU_SAVE_RESTORE */
  20. #ifdef CONFIG_ARC_PLAT_EZNPS
  21. extern void dp_save_restore(struct task_struct *p, struct task_struct *n);
  22. #define ARC_EZNPS_DP_PREV(p, n) dp_save_restore(p, n)
  23. #else
  24. #define ARC_EZNPS_DP_PREV(p, n)
  25. #endif /* !CONFIG_ARC_PLAT_EZNPS */
  26. struct task_struct *__switch_to(struct task_struct *p, struct task_struct *n);
  27. #define switch_to(prev, next, last) \
  28. do { \
  29. ARC_EZNPS_DP_PREV(prev, next); \
  30. ARC_FPU_PREV(prev, next); \
  31. last = __switch_to(prev, next);\
  32. ARC_FPU_NEXT(next); \
  33. mb(); \
  34. } while (0)
  35. #endif
  36. #endif