diff options
author | Richard Weinberger <richard@nod.at> | 2013-10-06 17:06:08 -0400 |
---|---|---|
committer | Richard Weinberger <richard@sigma-star.at> | 2014-08-06 07:01:31 -0400 |
commit | 1270cff147a39f7da5b25225dca6ca3132ca6130 (patch) | |
tree | 7ac7a5efbf0f3226aa0e9f46b7749f7dde5be594 | |
parent | d809709a8845954a95c2ac86c13bd0dfd549c1ae (diff) |
blackfin: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done()
for signal delivery.
Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Steven Miao <realmz6@gmail.com>
-rw-r--r-- | arch/blackfin/kernel/signal.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index b022af6c48f8..1389cd3b74e3 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -152,23 +152,22 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | static int | 154 | static int |
155 | setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | 155 | setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) |
156 | sigset_t * set, struct pt_regs *regs) | ||
157 | { | 156 | { |
158 | struct rt_sigframe *frame; | 157 | struct rt_sigframe *frame; |
159 | int err = 0; | 158 | int err = 0; |
160 | 159 | ||
161 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 160 | frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); |
162 | 161 | ||
163 | err |= __put_user((current_thread_info()->exec_domain | 162 | err |= __put_user((current_thread_info()->exec_domain |
164 | && current_thread_info()->exec_domain->signal_invmap | 163 | && current_thread_info()->exec_domain->signal_invmap |
165 | && sig < 32 | 164 | && ksig->sig < 32 |
166 | ? current_thread_info()->exec_domain-> | 165 | ? current_thread_info()->exec_domain-> |
167 | signal_invmap[sig] : sig), &frame->sig); | 166 | signal_invmap[ksig->sig] : ksig->sig), &frame->sig); |
168 | 167 | ||
169 | err |= __put_user(&frame->info, &frame->pinfo); | 168 | err |= __put_user(&frame->info, &frame->pinfo); |
170 | err |= __put_user(&frame->uc, &frame->puc); | 169 | err |= __put_user(&frame->uc, &frame->puc); |
171 | err |= copy_siginfo_to_user(&frame->info, info); | 170 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
172 | 171 | ||
173 | /* Create the ucontext. */ | 172 | /* Create the ucontext. */ |
174 | err |= __put_user(0, &frame->uc.uc_flags); | 173 | err |= __put_user(0, &frame->uc.uc_flags); |
@@ -183,7 +182,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
183 | /* Set up registers for signal handler */ | 182 | /* Set up registers for signal handler */ |
184 | if (current->personality & FDPIC_FUNCPTRS) { | 183 | if (current->personality & FDPIC_FUNCPTRS) { |
185 | struct fdpic_func_descriptor __user *funcptr = | 184 | struct fdpic_func_descriptor __user *funcptr = |
186 | (struct fdpic_func_descriptor *) ka->sa.sa_handler; | 185 | (struct fdpic_func_descriptor *) ksig->ka.sa.sa_handler; |
187 | u32 pc, p3; | 186 | u32 pc, p3; |
188 | err |= __get_user(pc, &funcptr->text); | 187 | err |= __get_user(pc, &funcptr->text); |
189 | err |= __get_user(p3, &funcptr->GOT); | 188 | err |= __get_user(p3, &funcptr->GOT); |
@@ -192,7 +191,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
192 | regs->pc = pc; | 191 | regs->pc = pc; |
193 | regs->p3 = p3; | 192 | regs->p3 = p3; |
194 | } else | 193 | } else |
195 | regs->pc = (unsigned long)ka->sa.sa_handler; | 194 | regs->pc = (unsigned long)ksig->ka.sa.sa_handler; |
196 | wrusp((unsigned long)frame); | 195 | wrusp((unsigned long)frame); |
197 | regs->rets = SIGRETURN_STUB; | 196 | regs->rets = SIGRETURN_STUB; |
198 | 197 | ||
@@ -237,20 +236,19 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
237 | * OK, we're invoking a handler | 236 | * OK, we're invoking a handler |
238 | */ | 237 | */ |
239 | static void | 238 | static void |
240 | handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | 239 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
241 | struct pt_regs *regs) | ||
242 | { | 240 | { |
241 | int ret; | ||
242 | |||
243 | /* are we from a system call? to see pt_regs->orig_p0 */ | 243 | /* are we from a system call? to see pt_regs->orig_p0 */ |
244 | if (regs->orig_p0 >= 0) | 244 | if (regs->orig_p0 >= 0) |
245 | /* If so, check system call restarting.. */ | 245 | /* If so, check system call restarting.. */ |
246 | handle_restart(regs, ka, 1); | 246 | handle_restart(regs, &ksig->ka, 1); |
247 | 247 | ||
248 | /* set up the stack frame */ | 248 | /* set up the stack frame */ |
249 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) | 249 | ret = setup_rt_frame(ksig, sigmask_to_save(), regs); |
250 | force_sigsegv(sig, current); | 250 | |
251 | else | 251 | signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); |
252 | signal_delivered(sig, info, ka, regs, | ||
253 | test_thread_flag(TIF_SINGLESTEP)); | ||
254 | } | 252 | } |
255 | 253 | ||
256 | /* | 254 | /* |
@@ -264,16 +262,13 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
264 | */ | 262 | */ |
265 | asmlinkage void do_signal(struct pt_regs *regs) | 263 | asmlinkage void do_signal(struct pt_regs *regs) |
266 | { | 264 | { |
267 | siginfo_t info; | 265 | struct ksignal ksig; |
268 | int signr; | ||
269 | struct k_sigaction ka; | ||
270 | 266 | ||
271 | current->thread.esp0 = (unsigned long)regs; | 267 | current->thread.esp0 = (unsigned long)regs; |
272 | 268 | ||
273 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 269 | if (get_signal(&ksig)) { |
274 | if (signr > 0) { | ||
275 | /* Whee! Actually deliver the signal. */ | 270 | /* Whee! Actually deliver the signal. */ |
276 | handle_signal(signr, &info, &ka, regs); | 271 | handle_signal(&ksig, regs); |
277 | return; | 272 | return; |
278 | } | 273 | } |
279 | 274 | ||