switch_to.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 disable_kernel_fp(void);
  18. extern void enable_kernel_fp(void);
  19. extern void flush_fp_to_thread(struct task_struct *);
  20. extern void enable_kernel_altivec(void);
  21. extern void load_up_altivec(struct task_struct *);
  22. extern int emulate_altivec(struct pt_regs *);
  23. extern void __giveup_vsx(struct task_struct *);
  24. extern void giveup_vsx(struct task_struct *);
  25. extern void enable_kernel_spe(void);
  26. extern void giveup_spe(struct task_struct *);
  27. extern void load_up_spe(struct task_struct *);
  28. #ifndef CONFIG_SMP
  29. extern void discard_lazy_cpu_state(void);
  30. #else
  31. static inline void discard_lazy_cpu_state(void)
  32. {
  33. }
  34. #endif
  35. #ifdef CONFIG_ALTIVEC
  36. extern void flush_altivec_to_thread(struct task_struct *);
  37. extern void giveup_altivec(struct task_struct *);
  38. extern void giveup_altivec_notask(void);
  39. #else
  40. static inline void flush_altivec_to_thread(struct task_struct *t)
  41. {
  42. }
  43. static inline void giveup_altivec(struct task_struct *t)
  44. {
  45. }
  46. #endif
  47. #ifdef CONFIG_VSX
  48. extern void flush_vsx_to_thread(struct task_struct *);
  49. #else
  50. static inline void flush_vsx_to_thread(struct task_struct *t)
  51. {
  52. }
  53. #endif
  54. #ifdef CONFIG_SPE
  55. extern void flush_spe_to_thread(struct task_struct *);
  56. #else
  57. static inline void flush_spe_to_thread(struct task_struct *t)
  58. {
  59. }
  60. #endif
  61. static inline void clear_task_ebb(struct task_struct *t)
  62. {
  63. #ifdef CONFIG_PPC_BOOK3S_64
  64. /* EBB perf events are not inherited, so clear all EBB state. */
  65. t->thread.bescr = 0;
  66. t->thread.mmcr2 = 0;
  67. t->thread.mmcr0 = 0;
  68. t->thread.siar = 0;
  69. t->thread.sdar = 0;
  70. t->thread.sier = 0;
  71. t->thread.used_ebb = 0;
  72. #endif
  73. }
  74. #endif /* _ASM_POWERPC_SWITCH_TO_H */