aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/signal_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/signal_64.c')
-rw-r--r--arch/sparc/kernel/signal_64.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 1ddf0dedb92..f0836cd0e2f 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -533,13 +533,23 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
533 * register for GDB to save and restore in order to get 533 * register for GDB to save and restore in order to get
534 * orig_i0 correct for syscall restarts when debugging. 534 * orig_i0 correct for syscall restarts when debugging.
535 * 535 *
536 * However, we luckily can use the fact that several registers 536 * Although it should be the case that most of the global
537 * are volatile across system calls. One such register is 537 * registers are volatile across a system call, glibc already
538 * %g2, so use that as a place to save away orig_i0. 538 * depends upon that fact that we preserve them. So we can't
539 * just use any global register to save away the orig_i0 value.
540 *
541 * In particular %g2, %g3, %g4, and %g5 are all assumed to be
542 * preserved across a system call trap by various pieces of
543 * code in glibc.
544 *
545 * %g7 is used as the "thread register". %g6 is not used in
546 * any fixed manner. %g6 is used as a scratch register and
547 * a compiler temporary, but it's value is never used across
548 * a system call. Therefore %g6 is usable for orig_i0 storage.
539 */ 549 */
540 if (pt_regs_is_syscall(regs) && 550 if (pt_regs_is_syscall(regs) &&
541 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) 551 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY)))
542 regs->u_regs[UREG_G2] = orig_i0; 552 regs->u_regs[UREG_G6] = orig_i0;
543 553
544 if (current_thread_info()->status & TS_RESTORE_SIGMASK) 554 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
545 oldset = &current->saved_sigmask; 555 oldset = &current->saved_sigmask;
@@ -560,7 +570,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
560 if (pt_regs_is_syscall(regs) && 570 if (pt_regs_is_syscall(regs) &&
561 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { 571 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
562 restart_syscall = 1; 572 restart_syscall = 1;
563 orig_i0 = regs->u_regs[UREG_G2]; 573 orig_i0 = regs->u_regs[UREG_G6];
564 } 574 }
565 575
566 if (signr > 0) { 576 if (signr > 0) {