Commit c18fe9a0 authored by Paul Mundt's avatar Paul Mundt

sh64: ppoll/pselect6() and restartable syscalls.

This patch was hanging around for some time while we were waiting
for the compiler situation to improve.. now that all is well again,
finally merge it.
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 599c26d3
...@@ -947,14 +947,14 @@ ret_with_reschedule: ...@@ -947,14 +947,14 @@ ret_with_reschedule:
! FIXME:!!! ! FIXME:!!!
! no handling of TIF_SYSCALL_TRACE yet!! ! no handling of TIF_SYSCALL_TRACE yet!!
movi (1 << TIF_NEED_RESCHED), r8 movi _TIF_NEED_RESCHED, r8
and r8, r7, r8 and r8, r7, r8
pta work_resched, tr0 pta work_resched, tr0
bne r8, ZERO, tr0 bne r8, ZERO, tr0
pta restore_all, tr1 pta restore_all, tr1
movi (1 << TIF_SIGPENDING), r8 movi (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), r8
and r8, r7, r8 and r8, r7, r8
pta work_notifysig, tr0 pta work_notifysig, tr0
bne r8, ZERO, tr0 bne r8, ZERO, tr0
......
...@@ -698,7 +698,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -698,7 +698,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
if (try_to_freeze()) if (try_to_freeze())
goto no_signal; goto no_signal;
if (!oldset) if (test_thread_flag(TIF_RESTORE_SIGMASK))
oldset = &current->saved_sigmask;
else if (!oldset)
oldset = &current->blocked; oldset = &current->blocked;
signr = get_signal_to_deliver(&info, &ka, regs, 0); signr = get_signal_to_deliver(&info, &ka, regs, 0);
...@@ -706,6 +708,15 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -706,6 +708,15 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
if (signr > 0) { if (signr > 0) {
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, oldset, regs); handle_signal(signr, &info, &ka, oldset, regs);
/*
* If a signal was successfully delivered, the saved sigmask
* is in its frame, and we can clear the TIF_RESTORE_SIGMASK
* flag.
*/
if (test_thread_flag(TIF_RESTORE_SIGMASK))
clear_thread_flag(TIF_RESTORE_SIGMASK);
return 1; return 1;
} }
...@@ -713,13 +724,27 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -713,13 +724,27 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
/* Did we come from a system call? */ /* Did we come from a system call? */
if (regs->syscall_nr >= 0) { if (regs->syscall_nr >= 0) {
/* Restart the system call - no handlers present */ /* Restart the system call - no handlers present */
if (regs->regs[REG_RET] == -ERESTARTNOHAND || switch (regs->regs[REG_RET]) {
regs->regs[REG_RET] == -ERESTARTSYS || case -ERESTARTNOHAND:
regs->regs[REG_RET] == -ERESTARTNOINTR) { case -ERESTARTSYS:
case -ERESTARTNOINTR:
/* Decode Syscall # */ /* Decode Syscall # */
regs->regs[REG_RET] = regs->syscall_nr; regs->regs[REG_RET] = regs->syscall_nr;
regs->pc -= 4; regs->pc -= 4;
break;
case -ERESTART_RESTARTBLOCK:
regs->regs[REG_RET] = __NR_restart_syscall;
regs->pc -= 4;
break;
} }
} }
/* No signal to deliver -- put the saved sigmask back */
if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
clear_thread_flag(TIF_RESTORE_SIGMASK);
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
}
return 0; return 0;
} }
...@@ -78,7 +78,13 @@ static inline struct thread_info *current_thread_info(void) ...@@ -78,7 +78,13 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SIGPENDING 2 /* signal pending */ #define TIF_SIGPENDING 2 /* signal pending */
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_MEMDIE 4 #define TIF_MEMDIE 4
#define TIF_RESTORE_SIGMASK 5 /* Restore signal mask in do_signal */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
#define _TIF_MEMDIE (1 << TIF_MEMDIE)
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment