aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/kernel
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-10-07 07:54:22 -0400
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 07:02:15 -0400
commit0f5bef660a7c3b030eb60ceb29e3b2d89f894f56 (patch)
tree3851309ba1fdfcd983a31c6e1591c6578cb87b84 /arch/m32r/kernel
parent98c20309b97fc30001adf643cf876125f334fd8a (diff)
m32r: 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>
Diffstat (limited to 'arch/m32r/kernel')
-rw-r--r--arch/m32r/kernel/signal.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index d503568cb753..cce3fd3ae923 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -173,17 +173,17 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
173 return (void __user *)((sp - frame_size) & -8ul); 173 return (void __user *)((sp - frame_size) & -8ul);
174} 174}
175 175
176static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 176static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
177 sigset_t *set, struct pt_regs *regs) 177 struct pt_regs *regs)
178{ 178{
179 struct rt_sigframe __user *frame; 179 struct rt_sigframe __user *frame;
180 int err = 0; 180 int err = 0;
181 int signal; 181 int signal, sig = ksig->sig;
182 182
183 frame = get_sigframe(ka, regs->spu, sizeof(*frame)); 183 frame = get_sigframe(&ksig->ka, regs->spu, sizeof(*frame));
184 184
185 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 185 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
186 goto give_sigsegv; 186 return -EFAULT;
187 187
188 signal = current_thread_info()->exec_domain 188 signal = current_thread_info()->exec_domain
189 && current_thread_info()->exec_domain->signal_invmap 189 && current_thread_info()->exec_domain->signal_invmap
@@ -193,13 +193,13 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
193 193
194 err |= __put_user(signal, &frame->sig); 194 err |= __put_user(signal, &frame->sig);
195 if (err) 195 if (err)
196 goto give_sigsegv; 196 return -EFAULT;
197 197
198 err |= __put_user(&frame->info, &frame->pinfo); 198 err |= __put_user(&frame->info, &frame->pinfo);
199 err |= __put_user(&frame->uc, &frame->puc); 199 err |= __put_user(&frame->uc, &frame->puc);
200 err |= copy_siginfo_to_user(&frame->info, info); 200 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
201 if (err) 201 if (err)
202 goto give_sigsegv; 202 return -EFAULT;
203 203
204 /* Create the ucontext. */ 204 /* Create the ucontext. */
205 err |= __put_user(0, &frame->uc.uc_flags); 205 err |= __put_user(0, &frame->uc.uc_flags);
@@ -208,17 +208,17 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
208 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 208 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
209 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 209 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
210 if (err) 210 if (err)
211 goto give_sigsegv; 211 return -EFAULT;
212 212
213 /* Set up to return from userspace. */ 213 /* Set up to return from userspace. */
214 regs->lr = (unsigned long)ka->sa.sa_restorer; 214 regs->lr = (unsigned long)ksig->ka.sa.sa_restorer;
215 215
216 /* Set up registers for signal handler */ 216 /* Set up registers for signal handler */
217 regs->spu = (unsigned long)frame; 217 regs->spu = (unsigned long)frame;
218 regs->r0 = signal; /* Arg for signal handler */ 218 regs->r0 = signal; /* Arg for signal handler */
219 regs->r1 = (unsigned long)&frame->info; 219 regs->r1 = (unsigned long)&frame->info;
220 regs->r2 = (unsigned long)&frame->uc; 220 regs->r2 = (unsigned long)&frame->uc;
221 regs->bpc = (unsigned long)ka->sa.sa_handler; 221 regs->bpc = (unsigned long)ksig->ka.sa.sa_handler;
222 222
223 set_fs(USER_DS); 223 set_fs(USER_DS);
224 224
@@ -228,10 +228,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
228#endif 228#endif
229 229
230 return 0; 230 return 0;
231
232give_sigsegv:
233 force_sigsegv(sig, current);
234 return -EFAULT;
235} 231}
236 232
237static int prev_insn(struct pt_regs *regs) 233static int prev_insn(struct pt_regs *regs)
@@ -252,9 +248,10 @@ static int prev_insn(struct pt_regs *regs)
252 */ 248 */
253 249
254static void 250static void
255handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 251handle_signal(struct ksignal *ksig, struct pt_regs *regs)
256 struct pt_regs *regs)
257{ 252{
253 int ret;
254
258 /* Are we from a system call? */ 255 /* Are we from a system call? */
259 if (regs->syscall_nr >= 0) { 256 if (regs->syscall_nr >= 0) {
260 /* If so, check system call restarting.. */ 257 /* If so, check system call restarting.. */
@@ -265,7 +262,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
265 break; 262 break;
266 263
267 case -ERESTARTSYS: 264 case -ERESTARTSYS:
268 if (!(ka->sa.sa_flags & SA_RESTART)) { 265 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
269 regs->r0 = -EINTR; 266 regs->r0 = -EINTR;
270 break; 267 break;
271 } 268 }
@@ -278,10 +275,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
278 } 275 }
279 276
280 /* Set up the stack frame */ 277 /* Set up the stack frame */
281 if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) 278 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
282 return;
283 279
284 signal_delivered(sig, info, ka, regs, 0); 280 signal_setup_done(ret, ksig, 0);
285} 281}
286 282
287/* 283/*
@@ -291,9 +287,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
291 */ 287 */
292static void do_signal(struct pt_regs *regs) 288static void do_signal(struct pt_regs *regs)
293{ 289{
294 siginfo_t info; 290 struct ksignal ksig;
295 int signr;
296 struct k_sigaction ka;
297 291
298 /* 292 /*
299 * We want the common case to go fast, which 293 * We want the common case to go fast, which
@@ -304,8 +298,7 @@ static void do_signal(struct pt_regs *regs)
304 if (!user_mode(regs)) 298 if (!user_mode(regs))
305 return; 299 return;
306 300
307 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 301 if (get_signal(&ksig)) {
308 if (signr > 0) {
309 /* Re-enable any watchpoints before delivering the 302 /* Re-enable any watchpoints before delivering the
310 * signal to user space. The processor register will 303 * signal to user space. The processor register will
311 * have been cleared if the watchpoint triggered 304 * have been cleared if the watchpoint triggered
@@ -313,7 +306,7 @@ static void do_signal(struct pt_regs *regs)
313 */ 306 */
314 307
315 /* Whee! Actually deliver the signal. */ 308 /* Whee! Actually deliver the signal. */
316 handle_signal(signr, &ka, &info, regs); 309 handle_signal(&ksig, regs);
317 310
318 return; 311 return;
319 } 312 }