s390/kernel: remove save_fpu_regs() parameter and use __LC_CURRENT instead
[linux-2.6-block.git] / arch / s390 / include / asm / switch_to.h
CommitLineData
a0616cde
DH
1/*
2 * Copyright IBM Corp. 1999, 2009
3 *
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
5 */
6
7#ifndef __ASM_SWITCH_TO_H
8#define __ASM_SWITCH_TO_H
9
10#include <linux/thread_info.h>
904818e2 11#include <asm/fpu-internal.h>
bee5c286 12#include <asm/ptrace.h>
a0616cde
DH
13
14extern struct task_struct *__switch_to(void *, void *);
64597f9d 15extern void update_cr_regs(struct task_struct *task);
a0616cde 16
a0616cde
DH
17static inline void save_access_regs(unsigned int *acrs)
18{
bee5c286
HC
19 typedef struct { int _[NUM_ACRS]; } acrstype;
20
21 asm volatile("stam 0,15,%0" : "=Q" (*(acrstype *)acrs));
a0616cde
DH
22}
23
24static inline void restore_access_regs(unsigned int *acrs)
25{
bee5c286
HC
26 typedef struct { int _[NUM_ACRS]; } acrstype;
27
28 asm volatile("lam 0,15,%0" : : "Q" (*(acrstype *)acrs));
a0616cde
DH
29}
30
31#define switch_to(prev,next,last) do { \
32 if (prev->mm) { \
d0164ee2 33 save_fpu_regs(); \
a0616cde 34 save_access_regs(&prev->thread.acrs[0]); \
e4b8b3f3 35 save_ri_cb(prev->thread.ri_cb); \
a0616cde
DH
36 } \
37 if (next->mm) { \
80703617 38 update_cr_regs(next); \
9977e886 39 set_cpu_flag(CIF_FPU); \
a0616cde 40 restore_access_regs(&next->thread.acrs[0]); \
e4b8b3f3 41 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \
a0616cde
DH
42 } \
43 prev = __switch_to(prev,next); \
44} while (0)
45
a0616cde 46#endif /* __ASM_SWITCH_TO_H */