aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/signal_64.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-04-19 18:37:09 -0400
committerRoland McGrath <roland@redhat.com>2008-07-26 17:38:04 -0400
commit4dfcbb997aa9f3a6a3ed8c192f0dac28b027e08f (patch)
treedb9c329002f21088126f8530ea7ea831f0ccc114 /arch/x86/kernel/signal_64.c
parent68bd0f4ef7750fc277e1268bf40f443898382409 (diff)
x86 signals: use asm/syscall.h
Replace local inlines with the asm/syscall.h interfaces that do the same things. Signed-off-by: Roland McGrath <roland@redhat.com>
Diffstat (limited to 'arch/x86/kernel/signal_64.c')
-rw-r--r--arch/x86/kernel/signal_64.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 3beb2db88c5a..cb7cf0216ab7 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -27,6 +27,7 @@
27#include <asm/proto.h> 27#include <asm/proto.h>
28#include <asm/ia32_unistd.h> 28#include <asm/ia32_unistd.h>
29#include <asm/mce.h> 29#include <asm/mce.h>
30#include <asm/syscall.h>
30#include "sigframe.h" 31#include "sigframe.h"
31 32
32#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 33#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -347,35 +348,6 @@ give_sigsegv:
347} 348}
348 349
349/* 350/*
350 * Return -1L or the syscall number that @regs is executing.
351 */
352static long current_syscall(struct pt_regs *regs)
353{
354 /*
355 * We always sign-extend a -1 value being set here,
356 * so this is always either -1L or a syscall number.
357 */
358 return regs->orig_ax;
359}
360
361/*
362 * Return a value that is -EFOO if the system call in @regs->orig_ax
363 * returned an error. This only works for @regs from @current.
364 */
365static long current_syscall_ret(struct pt_regs *regs)
366{
367#ifdef CONFIG_IA32_EMULATION
368 if (test_thread_flag(TIF_IA32))
369 /*
370 * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
371 * and will match correctly in comparisons.
372 */
373 return (int) regs->ax;
374#endif
375 return regs->ax;
376}
377
378/*
379 * OK, we're invoking a handler 351 * OK, we're invoking a handler
380 */ 352 */
381 353
@@ -386,9 +358,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
386 int ret; 358 int ret;
387 359
388 /* Are we from a system call? */ 360 /* Are we from a system call? */
389 if (current_syscall(regs) >= 0) { 361 if (syscall_get_nr(current, regs) >= 0) {
390 /* If so, check system call restarting.. */ 362 /* If so, check system call restarting.. */
391 switch (current_syscall_ret(regs)) { 363 switch (syscall_get_error(current, regs)) {
392 case -ERESTART_RESTARTBLOCK: 364 case -ERESTART_RESTARTBLOCK:
393 case -ERESTARTNOHAND: 365 case -ERESTARTNOHAND:
394 regs->ax = -EINTR; 366 regs->ax = -EINTR;
@@ -511,9 +483,9 @@ static void do_signal(struct pt_regs *regs)
511 } 483 }
512 484
513 /* Did we come from a system call? */ 485 /* Did we come from a system call? */
514 if (current_syscall(regs) >= 0) { 486 if (syscall_get_nr(current, regs) >= 0) {
515 /* Restart the system call - no handlers present */ 487 /* Restart the system call - no handlers present */
516 switch (current_syscall_ret(regs)) { 488 switch (syscall_get_error(current, regs)) {
517 case -ERESTARTNOHAND: 489 case -ERESTARTNOHAND:
518 case -ERESTARTSYS: 490 case -ERESTARTSYS:
519 case -ERESTARTNOINTR: 491 case -ERESTARTNOINTR: