Skip to content

Commit

Permalink
Fix of Linux signals for LM32 arch
Browse files Browse the repository at this point in the history
Sergey Koulik authored and Sebastien Bourdeauducq committed Mar 12, 2012
1 parent 329e85e commit c03a5b5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion arch/lm32/kernel/signal.c
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
#include <linux/personality.h>
#include <linux/tty.h>
#include <linux/hardirq.h>
#include <linux/freezer.h>

#include <asm/uaccess.h>
#include <asm/ucontext.h>
@@ -189,7 +190,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka,

#if DEBUG_SIG
printk("SIG deliver (%s:%d): frame=%p, sp=%p ra=%08lx ea=%08lx, signal(r1)=%d\n",
current->comm, current->pid, frame, regs->sp, regs->ra, regs->ea, signal);
current->comm, current->pid, frame, regs->sp, regs->ra, regs->ea, sig);
#endif

return regs->r1;
@@ -235,18 +236,28 @@ static int do_signal(int retval, struct pt_regs *regs)
* kernel mode. Just return without doing anything
* if so.
*/
if (!user_mode(regs))
return 0;

if (try_to_freeze())
goto no_signal;

if (test_thread_flag(TIF_RESTORE_SIGMASK))
oldset = &current->saved_sigmask;
else
oldset = &current->blocked;

signr = get_signal_to_deliver(&info, &ka, regs, NULL);

if (signr > 0) {
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, oldset, regs);
if (test_thread_flag(TIF_RESTORE_SIGMASK))
clear_thread_flag(TIF_RESTORE_SIGMASK);
return signr;
}

no_signal:
/* Did we come from a system call? */
if (regs->r8) {
/* Restart the system call - no handlers present */
@@ -261,6 +272,10 @@ static int do_signal(int retval, struct pt_regs *regs)
regs->ea -= 4; /* Size of scall insn. */
}
}
if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
clear_thread_flag(TIF_RESTORE_SIGMASK);
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
}

return retval;
}

0 comments on commit c03a5b5

Please sign in to comment.