switch_to.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  3. */
  4. #ifndef _ASM_POWERPC_SWITCH_TO_H
  5. #define _ASM_POWERPC_SWITCH_TO_H
  6. struct thread_struct;
  7. struct task_struct;
  8. struct pt_regs;
  9. extern struct task_struct *__switch_to(struct task_struct *,
  10. struct task_struct *);
  11. #define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
  12. struct thread_struct;
  13. extern struct task_struct *_switch(struct thread_struct *prev,
  14. struct thread_struct *next);
  15. extern void giveup_fpu(struct task_struct *);
  16. extern void load_up_fpu(void);
  17. extern void enable_kernel_fp(void);
  18. extern void enable_kernel_altivec(void);
  19. extern void load_up_altivec(struct task_struct *);
  20. extern int emulate_altivec(struct pt_regs *);
  21. extern void __giveup_vsx(struct task_struct *);
  22. extern void giveup_vsx(struct task_struct *);
  23. extern void enable_kernel_spe(void);
  24. extern void giveup_spe(struct task_struct *);
  25. extern void load_up_spe(struct task_struct *);
  26. #ifndef CONFIG_SMP
  27. extern void discard_lazy_cpu_state(void);
  28. #else
  29. static inline void discard_lazy_cpu_state(void)
  30. {
  31. }
  32. #endif
  33. #ifdef CONFIG_PPC_FPU
  34. extern void flush_fp_to_thread(struct task_struct *);
  35. #else
  36. static inline void flush_fp_to_thread(struct task_struct *t) { }
  37. #endif
  38. #ifdef CONFIG_ALTIVEC
  39. extern void flush_altivec_to_thread(struct task_struct *);
  40. extern void giveup_altivec(struct task_struct *);
  41. extern void giveup_altivec_notask(void);
  42. #else
  43. static inline void flush_altivec_to_thread(struct task_struct *t)
  44. {
  45. }
  46. static inline void giveup_altivec(struct task_struct *t)
  47. {
  48. }
  49. #endif
  50. #ifdef CONFIG_VSX
  51. extern void flush_vsx_to_thread(struct task_struct *);
  52. #else
  53. static inline void flush_vsx_to_thread(struct task_struct *t)
  54. {
  55. }
  56. #endif
  57. #ifdef CONFIG_SPE
  58. extern void flush_spe_to_thread(struct task_struct *);
  59. #else
  60. static inline void flush_spe_to_thread(struct task_struct *t)
  61. {
  62. }
  63. #endif
  64. static inline void clear_task_ebb(struct task_struct *t)
  65. {
  66. #ifdef CONFIG_PPC_BOOK3S_64
  67. /* EBB perf events are not inherited, so clear all EBB state. */
  68. t->thread.bescr = 0;
  69. t->thread.mmcr2 = 0;
  70. t->thread.mmcr0 = 0;
  71. t->thread.siar = 0;
  72. t->thread.sdar = 0;
  73. t->thread.sier = 0;
  74. t->thread.used_ebb = 0;
  75. #endif
  76. }
  77. #endif /* _ASM_POWERPC_SWITCH_TO_H */