blob: 685ecc86aa8bb18e67c57d59a27a240f93353c64 [file] [log] [blame]
David Howellsae3a1972012-03-28 18:30:02 +01001/*
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
7struct thread_struct;
8struct task_struct;
9struct pt_regs;
10
11extern struct task_struct *__switch_to(struct task_struct *,
12 struct task_struct *);
13#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
14
15struct thread_struct;
16extern struct task_struct *_switch(struct thread_struct *prev,
17 struct thread_struct *next);
Michael Neuling80737512013-08-09 17:29:30 +100018#ifdef CONFIG_PPC_BOOK3S_64
19static inline void save_tar(struct thread_struct *prev)
20{
21 if (cpu_has_feature(CPU_FTR_ARCH_207S))
22 prev->tar = mfspr(SPRN_TAR);
23}
24#else
25static inline void save_tar(struct thread_struct *prev) {}
26#endif
David Howellsae3a1972012-03-28 18:30:02 +010027
28extern void giveup_fpu(struct task_struct *);
Scott Wood8fae8452011-12-20 15:34:45 +000029extern void load_up_fpu(void);
David Howellsae3a1972012-03-28 18:30:02 +010030extern void disable_kernel_fp(void);
31extern void enable_kernel_fp(void);
32extern void flush_fp_to_thread(struct task_struct *);
33extern void enable_kernel_altivec(void);
David Howellsae3a1972012-03-28 18:30:02 +010034extern void load_up_altivec(struct task_struct *);
35extern int emulate_altivec(struct pt_regs *);
36extern void __giveup_vsx(struct task_struct *);
37extern void giveup_vsx(struct task_struct *);
38extern void enable_kernel_spe(void);
39extern void giveup_spe(struct task_struct *);
40extern void load_up_spe(struct task_struct *);
41
42#ifndef CONFIG_SMP
43extern void discard_lazy_cpu_state(void);
44#else
45static inline void discard_lazy_cpu_state(void)
46{
47}
48#endif
49
50#ifdef CONFIG_ALTIVEC
51extern void flush_altivec_to_thread(struct task_struct *);
Anton Blanchard8cd3c232012-04-15 20:54:59 +000052extern void giveup_altivec(struct task_struct *);
Anton Blanchard35000872012-04-15 20:56:45 +000053extern void giveup_altivec_notask(void);
David Howellsae3a1972012-03-28 18:30:02 +010054#else
55static inline void flush_altivec_to_thread(struct task_struct *t)
56{
57}
Anton Blanchard8cd3c232012-04-15 20:54:59 +000058static inline void giveup_altivec(struct task_struct *t)
59{
60}
David Howellsae3a1972012-03-28 18:30:02 +010061#endif
62
63#ifdef CONFIG_VSX
64extern void flush_vsx_to_thread(struct task_struct *);
65#else
66static inline void flush_vsx_to_thread(struct task_struct *t)
67{
68}
69#endif
70
71#ifdef CONFIG_SPE
72extern void flush_spe_to_thread(struct task_struct *);
73#else
74static inline void flush_spe_to_thread(struct task_struct *t)
75{
76}
77#endif
78
79#endif /* _ASM_POWERPC_SWITCH_TO_H */