2 * Copyright IBM Corp. 1999, 2009
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 #ifndef __ASM_SWITCH_TO_H
8 #define __ASM_SWITCH_TO_H
10 #include <linux/thread_info.h>
11 #include <asm/fpu-internal.h>
12 #include <asm/ptrace.h>
14 extern struct task_struct
*__switch_to(void *, void *);
15 extern void update_cr_regs(struct task_struct
*task
);
17 static inline void save_access_regs(unsigned int *acrs
)
19 typedef struct { int _
[NUM_ACRS
]; } acrstype
;
21 asm volatile("stam 0,15,%0" : "=Q" (*(acrstype
*)acrs
));
24 static inline void restore_access_regs(unsigned int *acrs
)
26 typedef struct { int _
[NUM_ACRS
]; } acrstype
;
28 asm volatile("lam 0,15,%0" : : "Q" (*(acrstype
*)acrs
));
31 #define switch_to(prev,next,last) do { \
34 save_access_regs(&prev->thread.acrs[0]); \
35 save_ri_cb(prev->thread.ri_cb); \
38 update_cr_regs(next); \
39 set_cpu_flag(CIF_FPU); \
40 restore_access_regs(&next->thread.acrs[0]); \
41 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \
43 prev = __switch_to(prev,next); \
46 #endif /* __ASM_SWITCH_TO_H */