Commit ac66f3fd authored by Harvey Harrison's avatar Harvey Harrison Committed by Ingo Molnar

x86: reduce trivial style differences in signal_32|64.c

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent c3e6ff87
...@@ -131,14 +131,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax ...@@ -131,14 +131,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
COPY_SEG(fs); COPY_SEG(fs);
COPY_SEG(es); COPY_SEG(es);
COPY_SEG(ds); COPY_SEG(ds);
COPY(di); COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
COPY(si); COPY(dx); COPY(cx); COPY(ip);
COPY(bp);
COPY(sp);
COPY(bx);
COPY(dx);
COPY(cx);
COPY(ip);
COPY_SEG_STRICT(cs); COPY_SEG_STRICT(cs);
COPY_SEG_STRICT(ss); COPY_SEG_STRICT(ss);
...@@ -412,7 +406,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, ...@@ -412,7 +406,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
ptrace_notify(SIGTRAP); ptrace_notify(SIGTRAP);
#if DEBUG_SIG #if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%p\n",
current->comm, current->pid, frame, regs->ip, frame->pretcode); current->comm, current->pid, frame, regs->ip, frame->pretcode);
#endif #endif
...@@ -522,7 +516,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -522,7 +516,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
static int static int
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
sigset_t *oldset, struct pt_regs * regs) sigset_t *oldset, struct pt_regs *regs)
{ {
int ret; int ret;
...@@ -530,20 +524,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -530,20 +524,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
if ((long)regs->orig_ax >= 0) { if ((long)regs->orig_ax >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
switch (regs->ax) { switch (regs->ax) {
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
regs->ax = -EINTR;
break;
case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) {
regs->ax = -EINTR; regs->ax = -EINTR;
break; break;
}
case -ERESTARTSYS: /* fallthrough */
if (!(ka->sa.sa_flags & SA_RESTART)) { case -ERESTARTNOINTR:
regs->ax = -EINTR; regs->ax = regs->orig_ax;
break; regs->ip -= 2;
} break;
/* fallthrough */
case -ERESTARTNOINTR:
regs->ax = regs->orig_ax;
regs->ip -= 2;
} }
} }
...@@ -580,18 +575,17 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -580,18 +575,17 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
*/ */
static void do_signal(struct pt_regs *regs) static void do_signal(struct pt_regs *regs)
{ {
struct k_sigaction ka;
siginfo_t info; siginfo_t info;
int signr; int signr;
struct k_sigaction ka;
sigset_t *oldset; sigset_t *oldset;
/* /*
* We want the common case to go fast, which * We want the common case to go fast, which is why we may in certain
* is why we may in certain cases get here from * cases get here from kernel mode. Just return without doing anything
* kernel mode. Just return without doing anything * if so.
* if so. vm86 regs switched out by assembly code * X86_32: vm86 regs switched out by assembly code before reaching
* before reaching here, so testing against kernel * here, so testing against kernel CS suffices.
* CS suffices.
*/ */
if (!user_mode(regs)) if (!user_mode(regs))
return; return;
...@@ -608,7 +602,7 @@ static void do_signal(struct pt_regs *regs) ...@@ -608,7 +602,7 @@ static void do_signal(struct pt_regs *regs)
* have been cleared if the watchpoint triggered * have been cleared if the watchpoint triggered
* inside the kernel. * inside the kernel.
*/ */
if (unlikely(current->thread.debugreg7)) if (current->thread.debugreg7)
set_debugreg(current->thread.debugreg7, 7); set_debugreg(current->thread.debugreg7, 7);
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
...@@ -642,8 +636,10 @@ static void do_signal(struct pt_regs *regs) ...@@ -642,8 +636,10 @@ static void do_signal(struct pt_regs *regs)
} }
} }
/* if there's no signal to deliver, we just put the saved sigmask /*
* back */ * If there's no signal to deliver, we just put the saved sigmask
* back.
*/
if (test_thread_flag(TIF_RESTORE_SIGMASK)) { if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
clear_thread_flag(TIF_RESTORE_SIGMASK); clear_thread_flag(TIF_RESTORE_SIGMASK);
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
...@@ -654,12 +650,12 @@ static void do_signal(struct pt_regs *regs) ...@@ -654,12 +650,12 @@ static void do_signal(struct pt_regs *regs)
* notification of userspace execution resumption * notification of userspace execution resumption
* - triggered by the TIF_WORK_MASK flags * - triggered by the TIF_WORK_MASK flags
*/ */
void do_notify_resume(struct pt_regs *regs, void *_unused, void do_notify_resume(struct pt_regs *regs, void *unused,
__u32 thread_info_flags) __u32 thread_info_flags)
{ {
/* Pending single-step? */ /* Pending single-step? */
if (thread_info_flags & _TIF_SINGLESTEP) { if (thread_info_flags & _TIF_SINGLESTEP) {
regs->flags |= TF_MASK; regs->flags |= X86_EFLAGS_TF;
clear_thread_flag(TIF_SINGLESTEP); clear_thread_flag(TIF_SINGLESTEP);
} }
......
...@@ -345,7 +345,7 @@ static long current_syscall_ret(struct pt_regs *regs) ...@@ -345,7 +345,7 @@ static long current_syscall_ret(struct pt_regs *regs)
static int static int
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
sigset_t *oldset, struct pt_regs *regs) sigset_t *oldset, struct pt_regs *regs)
{ {
int ret; int ret;
...@@ -359,21 +359,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -359,21 +359,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
if (current_syscall(regs) >= 0) { if (current_syscall(regs) >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
switch (current_syscall_ret(regs)) { switch (current_syscall_ret(regs)) {
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
regs->ax = -EINTR; regs->ax = -EINTR;
break; break;
case -ERESTARTSYS: case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) { if (!(ka->sa.sa_flags & SA_RESTART)) {
regs->ax = -EINTR; regs->ax = -EINTR;
break;
}
/* fallthrough */
case -ERESTARTNOINTR:
regs->ax = regs->orig_ax;
regs->ip -= 2;
break; break;
}
/* fallthrough */
case -ERESTARTNOINTR:
regs->ax = regs->orig_ax;
regs->ip -= 2;
break;
} }
} }
...@@ -420,10 +420,11 @@ static void do_signal(struct pt_regs *regs) ...@@ -420,10 +420,11 @@ static void do_signal(struct pt_regs *regs)
sigset_t *oldset; sigset_t *oldset;
/* /*
* We want the common case to go fast, which * We want the common case to go fast, which is why we may in certain
* is why we may in certain cases get here from * cases get here from kernel mode. Just return without doing anything
* kernel mode. Just return without doing anything
* if so. * if so.
* X86_32: vm86 regs switched out by assembly code before reaching
* here, so testing against kernel CS suffices.
*/ */
if (!user_mode(regs)) if (!user_mode(regs))
return; return;
...@@ -473,16 +474,18 @@ static void do_signal(struct pt_regs *regs) ...@@ -473,16 +474,18 @@ static void do_signal(struct pt_regs *regs)
} }
} }
/* if there's no signal to deliver, we just put the saved sigmask /*
back. */ * If there's no signal to deliver, we just put the saved sigmask
* back.
*/
if (test_thread_flag(TIF_RESTORE_SIGMASK)) { if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
clear_thread_flag(TIF_RESTORE_SIGMASK); clear_thread_flag(TIF_RESTORE_SIGMASK);
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
} }
} }
void void do_notify_resume(struct pt_regs *regs, void *unused,
do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) __u32 thread_info_flags)
{ {
#ifdef DEBUG_SIG #ifdef DEBUG_SIG
printk("do_notify_resume flags:%x ip:%lx sp:%lx caller:%p pending:%x\n", printk("do_notify_resume flags:%x ip:%lx sp:%lx caller:%p pending:%x\n",
...@@ -502,7 +505,7 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) ...@@ -502,7 +505,7 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
#endif /* CONFIG_X86_MCE */ #endif /* CONFIG_X86_MCE */
/* deal with pending signal delivery */ /* deal with pending signal delivery */
if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK)) if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
do_signal(regs); do_signal(regs);
if (thread_info_flags & _TIF_HRTICK_RESCHED) if (thread_info_flags & _TIF_HRTICK_RESCHED)
......
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