Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116121
b: refs/heads/master
c: f8b890a
h: refs/heads/master
i:
  116119: d5b6512
v: v3
  • Loading branch information
Paul Mundt committed Sep 12, 2008
1 parent 93cc6d7 commit 486d713
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb700aa4f13d38726defab3060d3ebeaf67dc189
refs/heads/master: f8b890ab4ca60c05b5621b267712709d329f7612
53 changes: 31 additions & 22 deletions trunk/arch/sh/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,37 +490,43 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
return -EFAULT;
}

static inline void
handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
struct sigaction *sa)
{
/* If we're not from a syscall, bail out */
if (regs->tra < 0)
return;

/* check for system call restart.. */
switch (regs->regs[0]) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:
no_system_call_restart:
regs->regs[0] = -EINTR;
regs->sr |= 1;
break;

case -ERESTARTSYS:
if (!(sa->sa_flags & SA_RESTART))
goto no_system_call_restart;
/* fallthrough */
case -ERESTARTNOINTR:
regs->regs[0] = save_r0;
regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
break;
}
}

/*
* OK, we're invoking a handler
*/

static int
handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0)
{
int ret;

/* Are we from a system call? */
if (regs->tra >= 0) {
/* If so, check system call restarting.. */
switch (regs->regs[0]) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:
no_system_call_restart:
regs->regs[0] = -EINTR;
break;

case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART))
goto no_system_call_restart;
/* fallthrough */
case -ERESTARTNOINTR:
regs->regs[0] = save_r0;
regs->pc -= instruction_size(
ctrl_inw(regs->pc - 4));
break;
}
}

/* Set up the stack frame */
if (ka->sa.sa_flags & SA_SIGINFO)
Expand Down Expand Up @@ -578,6 +584,9 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)

signr = get_signal_to_deliver(&info, &ka, regs, NULL);
if (signr > 0) {
if (regs->sr & 1)
handle_syscall_restart(save_r0, regs, &ka.sa);

/* Whee! Actually deliver the signal. */
if (handle_signal(signr, &ka, &info, oldset,
regs, save_r0) == 0) {
Expand Down

0 comments on commit 486d713

Please sign in to comment.