switch_to.h 2.2 KB

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