aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-06-15 15:28:03 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-18 11:17:45 -0400
commitaca6ca10974aa78adfb47291722ce851160213e4 (patch)
tree5e1daa21e63d19c5bab1a2f00eb6b8e1dcc6e9ea /arch
parent680714844fd1dcc6f03b22353103985be9d58db6 (diff)
[ARM] Gather common sigframe saving code into setup_sigframe()
Gather the common sigmask savbing code inside setup_sigcontext(), and rename the function setup_sigframe(). Pass it a sigframe structure. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/signal.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 1e2b54d32172..962851144099 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -325,41 +325,42 @@ badframe:
325} 325}
326 326
327static int 327static int
328setup_sigcontext(struct sigcontext __user *sc, struct aux_sigframe __user *aux, 328setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
329 struct pt_regs *regs, unsigned long mask)
330{ 329{
331 int err = 0; 330 int err = 0;
332 331
333 __put_user_error(regs->ARM_r0, &sc->arm_r0, err); 332 __put_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err);
334 __put_user_error(regs->ARM_r1, &sc->arm_r1, err); 333 __put_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err);
335 __put_user_error(regs->ARM_r2, &sc->arm_r2, err); 334 __put_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err);
336 __put_user_error(regs->ARM_r3, &sc->arm_r3, err); 335 __put_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err);
337 __put_user_error(regs->ARM_r4, &sc->arm_r4, err); 336 __put_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err);
338 __put_user_error(regs->ARM_r5, &sc->arm_r5, err); 337 __put_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err);
339 __put_user_error(regs->ARM_r6, &sc->arm_r6, err); 338 __put_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err);
340 __put_user_error(regs->ARM_r7, &sc->arm_r7, err); 339 __put_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err);
341 __put_user_error(regs->ARM_r8, &sc->arm_r8, err); 340 __put_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err);
342 __put_user_error(regs->ARM_r9, &sc->arm_r9, err); 341 __put_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err);
343 __put_user_error(regs->ARM_r10, &sc->arm_r10, err); 342 __put_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err);
344 __put_user_error(regs->ARM_fp, &sc->arm_fp, err); 343 __put_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err);
345 __put_user_error(regs->ARM_ip, &sc->arm_ip, err); 344 __put_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err);
346 __put_user_error(regs->ARM_sp, &sc->arm_sp, err); 345 __put_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err);
347 __put_user_error(regs->ARM_lr, &sc->arm_lr, err); 346 __put_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err);
348 __put_user_error(regs->ARM_pc, &sc->arm_pc, err); 347 __put_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err);
349 __put_user_error(regs->ARM_cpsr, &sc->arm_cpsr, err); 348 __put_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err);
350 349
351 __put_user_error(current->thread.trap_no, &sc->trap_no, err); 350 __put_user_error(current->thread.trap_no, &sf->uc.uc_mcontext.trap_no, err);
352 __put_user_error(current->thread.error_code, &sc->error_code, err); 351 __put_user_error(current->thread.error_code, &sf->uc.uc_mcontext.error_code, err);
353 __put_user_error(current->thread.address, &sc->fault_address, err); 352 __put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err);
354 __put_user_error(mask, &sc->oldmask, err); 353 __put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err);
354
355 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
355 356
356#ifdef CONFIG_IWMMXT 357#ifdef CONFIG_IWMMXT
357 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 358 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
358 err |= preserve_iwmmxt_context(&aux->iwmmxt); 359 err |= preserve_iwmmxt_context(&sf->aux.iwmmxt);
359#endif 360#endif
360#ifdef CONFIG_VFP 361#ifdef CONFIG_VFP
361// if (err == 0) 362// if (err == 0)
362// err |= vfp_save_state(&aux->vfp); 363// err |= vfp_save_state(&sf->aux.vfp);
363#endif 364#endif
364 365
365 return err; 366 return err;
@@ -469,9 +470,7 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg
469 if (!frame) 470 if (!frame)
470 return 1; 471 return 1;
471 472
472 err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->aux, regs, set->sig[0]); 473 err |= setup_sigframe(frame, regs, set);
473 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
474
475 if (err == 0) 474 if (err == 0)
476 err = setup_return(regs, ka, frame->retcode, frame, usig); 475 err = setup_return(regs, ka, frame->retcode, frame, usig);
477 476
@@ -500,10 +499,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
500 stack.ss_size = current->sas_ss_size; 499 stack.ss_size = current->sas_ss_size;
501 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack)); 500 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
502 501
503 err |= setup_sigcontext(&frame->sig.uc.uc_mcontext, &frame->sig.aux, 502 err |= setup_sigframe(&frame->sig, regs, set);
504 regs, set->sig[0]);
505 err |= __copy_to_user(&frame->sig.uc.uc_sigmask, set, sizeof(*set));
506
507 if (err == 0) 503 if (err == 0)
508 err = setup_return(regs, ka, frame->sig.retcode, frame, usig); 504 err = setup_return(regs, ka, frame->sig.retcode, frame, usig);
509 505