2 * Copyright (c) 2007 Benjamin Herrenschmidt, IBM Corporation
3 * Extracted from signal_32.c and signal_64.c
5 * This file is subject to the terms and conditions of the GNU General
6 * Public License. See the file README.legal in the main directory of
7 * this archive for more details.
10 #ifndef _POWERPC_ARCH_SIGNAL_H
11 #define _POWERPC_ARCH_SIGNAL_H
13 void __user
*get_sigframe(struct ksignal
*ksig
, struct task_struct
*tsk
,
14 size_t frame_size
, int is_32
);
16 extern int handle_signal32(struct ksignal
*ksig
, sigset_t
*oldset
,
17 struct task_struct
*tsk
);
19 extern int handle_rt_signal32(struct ksignal
*ksig
, sigset_t
*oldset
,
20 struct task_struct
*tsk
);
23 extern unsigned long copy_vsx_to_user(void __user
*to
,
24 struct task_struct
*task
);
25 extern unsigned long copy_ckvsx_to_user(void __user
*to
,
26 struct task_struct
*task
);
27 extern unsigned long copy_vsx_from_user(struct task_struct
*task
,
29 extern unsigned long copy_ckvsx_from_user(struct task_struct
*task
,
31 unsigned long copy_fpr_to_user(void __user
*to
, struct task_struct
*task
);
32 unsigned long copy_ckfpr_to_user(void __user
*to
, struct task_struct
*task
);
33 unsigned long copy_fpr_from_user(struct task_struct
*task
, void __user
*from
);
34 unsigned long copy_ckfpr_from_user(struct task_struct
*task
, void __user
*from
);
36 #define unsafe_copy_fpr_to_user(to, task, label) do { \
37 struct task_struct *__t = task; \
38 u64 __user *buf = (u64 __user *)to; \
41 for (i = 0; i < ELF_NFPREG - 1 ; i++) \
42 unsafe_put_user(__t->thread.TS_FPR(i), &buf[i], label); \
43 unsafe_put_user(__t->thread.fp_state.fpscr, &buf[i], label); \
46 #define unsafe_copy_vsx_to_user(to, task, label) do { \
47 struct task_struct *__t = task; \
48 u64 __user *buf = (u64 __user *)to; \
51 for (i = 0; i < ELF_NVSRHALFREG ; i++) \
52 unsafe_put_user(__t->thread.fp_state.fpr[i][TS_VSRLOWOFFSET], \
56 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
57 #define unsafe_copy_ckfpr_to_user(to, task, label) do { \
58 struct task_struct *__t = task; \
59 u64 __user *buf = (u64 __user *)to; \
62 for (i = 0; i < ELF_NFPREG - 1 ; i++) \
63 unsafe_put_user(__t->thread.TS_CKFPR(i), &buf[i], label);\
64 unsafe_put_user(__t->thread.ckfp_state.fpscr, &buf[i], label); \
67 #define unsafe_copy_ckvsx_to_user(to, task, label) do { \
68 struct task_struct *__t = task; \
69 u64 __user *buf = (u64 __user *)to; \
72 for (i = 0; i < ELF_NVSRHALFREG ; i++) \
73 unsafe_put_user(__t->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET], \
77 #elif defined(CONFIG_PPC_FPU_REGS)
79 #define unsafe_copy_fpr_to_user(to, task, label) \
80 unsafe_copy_to_user(to, (task)->thread.fp_state.fpr, \
81 ELF_NFPREG * sizeof(double), label)
83 static inline unsigned long
84 copy_fpr_to_user(void __user
*to
, struct task_struct
*task
)
86 return __copy_to_user(to
, task
->thread
.fp_state
.fpr
,
87 ELF_NFPREG
* sizeof(double));
90 static inline unsigned long
91 copy_fpr_from_user(struct task_struct
*task
, void __user
*from
)
93 return __copy_from_user(task
->thread
.fp_state
.fpr
, from
,
94 ELF_NFPREG
* sizeof(double));
97 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
98 #define unsafe_copy_ckfpr_to_user(to, task, label) \
99 unsafe_copy_to_user(to, (task)->thread.ckfp_state.fpr, \
100 ELF_NFPREG * sizeof(double), label)
102 inline unsigned long copy_ckfpr_to_user(void __user
*to
, struct task_struct
*task
)
104 return __copy_to_user(to
, task
->thread
.ckfp_state
.fpr
,
105 ELF_NFPREG
* sizeof(double));
108 static inline unsigned long
109 copy_ckfpr_from_user(struct task_struct
*task
, void __user
*from
)
111 return __copy_from_user(task
->thread
.ckfp_state
.fpr
, from
,
112 ELF_NFPREG
* sizeof(double));
114 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
116 #define unsafe_copy_fpr_to_user(to, task, label) do { } while (0)
118 static inline unsigned long
119 copy_fpr_to_user(void __user
*to
, struct task_struct
*task
)
124 static inline unsigned long
125 copy_fpr_from_user(struct task_struct
*task
, void __user
*from
)
133 extern int handle_rt_signal64(struct ksignal
*ksig
, sigset_t
*set
,
134 struct task_struct
*tsk
);
136 #else /* CONFIG_PPC64 */
138 extern long sys_rt_sigreturn(void);
139 extern long sys_sigreturn(void);
141 static inline int handle_rt_signal64(struct ksignal
*ksig
, sigset_t
*set
,
142 struct task_struct
*tsk
)
147 #endif /* !defined(CONFIG_PPC64) */
149 void signal_fault(struct task_struct
*tsk
, struct pt_regs
*regs
,
150 const char *where
, void __user
*ptr
);
152 #endif /* _POWERPC_ARCH_SIGNAL_H */