signal_64.c (5c34202b8bf942da411b6599668a76b07449bbfd) | signal_64.c (22e38f29328296d9d4cc33e46fd32a63e807abaf) |
---|---|
1/* 2 * PowerPC version 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 4 * 5 * Derived from "arch/i386/kernel/signal.c" 6 * Copyright (C) 1991, 1992 Linus Torvalds 7 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 8 * --- 20 unchanged lines hidden (view full) --- 29#include <asm/ucontext.h> 30#include <asm/uaccess.h> 31#include <asm/pgtable.h> 32#include <asm/unistd.h> 33#include <asm/cacheflush.h> 34#include <asm/syscalls.h> 35#include <asm/vdso.h> 36 | 1/* 2 * PowerPC version 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 4 * 5 * Derived from "arch/i386/kernel/signal.c" 6 * Copyright (C) 1991, 1992 Linus Torvalds 7 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 8 * --- 20 unchanged lines hidden (view full) --- 29#include <asm/ucontext.h> 30#include <asm/uaccess.h> 31#include <asm/pgtable.h> 32#include <asm/unistd.h> 33#include <asm/cacheflush.h> 34#include <asm/syscalls.h> 35#include <asm/vdso.h> 36 |
37#include "signal.h" 38 |
|
37#define DEBUG_SIG 0 38 39#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40 41#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) 42#define FP_REGS_SIZE sizeof(elf_fpregset_t) 43 44#define TRAMP_TRACEBACK 3 --- 413 unchanged lines hidden (view full) --- 458 sigaddset(¤t->blocked,sig); 459 recalc_sigpending(); 460 spin_unlock_irq(¤t->sighand->siglock); 461 } 462 463 return ret; 464} 465 | 39#define DEBUG_SIG 0 40 41#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 42 43#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) 44#define FP_REGS_SIZE sizeof(elf_fpregset_t) 45 46#define TRAMP_TRACEBACK 3 --- 413 unchanged lines hidden (view full) --- 460 sigaddset(¤t->blocked,sig); 461 recalc_sigpending(); 462 spin_unlock_irq(¤t->sighand->siglock); 463 } 464 465 return ret; 466} 467 |
466static inline void syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) 467{ 468 switch ((int)regs->result) { 469 case -ERESTART_RESTARTBLOCK: 470 case -ERESTARTNOHAND: 471 /* ERESTARTNOHAND means that the syscall should only be 472 * restarted if there was no handler for the signal, and since 473 * we only get here if there is a handler, we dont restart. 474 */ 475 regs->result = -EINTR; 476 regs->gpr[3] = EINTR; 477 regs->ccr |= 0x10000000; 478 break; 479 case -ERESTARTSYS: 480 /* ERESTARTSYS means to restart the syscall if there is no 481 * handler or the handler was registered with SA_RESTART 482 */ 483 if (!(ka->sa.sa_flags & SA_RESTART)) { 484 regs->result = -EINTR; 485 regs->gpr[3] = EINTR; 486 regs->ccr |= 0x10000000; 487 break; 488 } 489 /* fallthrough */ 490 case -ERESTARTNOINTR: 491 /* ERESTARTNOINTR means that the syscall should be 492 * called again after the signal handler returns. 493 */ 494 regs->gpr[3] = regs->orig_gpr3; 495 regs->nip -= 4; 496 regs->result = 0; 497 break; 498 } 499} 500 | |
501/* 502 * Note that 'init' is a special process: it doesn't get signals it doesn't 503 * want to handle. Thus you cannot kill init even with a SIGKILL even by 504 * mistake. 505 */ 506int do_signal(sigset_t *oldset, struct pt_regs *regs) 507{ 508 siginfo_t info; --- 8 unchanged lines hidden (view full) --- 517 return do_signal32(oldset, regs); 518 519 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 520 oldset = ¤t->saved_sigmask; 521 else if (!oldset) 522 oldset = ¤t->blocked; 523 524 signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 468/* 469 * Note that 'init' is a special process: it doesn't get signals it doesn't 470 * want to handle. Thus you cannot kill init even with a SIGKILL even by 471 * mistake. 472 */ 473int do_signal(sigset_t *oldset, struct pt_regs *regs) 474{ 475 siginfo_t info; --- 8 unchanged lines hidden (view full) --- 484 return do_signal32(oldset, regs); 485 486 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 487 oldset = ¤t->saved_sigmask; 488 else if (!oldset) 489 oldset = ¤t->blocked; 490 491 signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
492 493 /* Is there any syscall restart business here ? */ 494 check_syscall_restart(regs, &ka, signr > 0); 495 |
|
525 if (signr > 0) { 526 int ret; 527 | 496 if (signr > 0) { 497 int ret; 498 |
528 /* Whee! Actually deliver the signal. */ 529 if (TRAP(regs) == 0x0C00) 530 syscall_restart(regs, &ka); 531 | |
532 /* 533 * Reenable the DABR before delivering the signal to 534 * user space. The DABR will have been cleared if it 535 * triggered inside the kernel. 536 */ 537 if (current->thread.dabr) 538 set_dabr(current->thread.dabr); 539 | 499 /* 500 * Reenable the DABR before delivering the signal to 501 * user space. The DABR will have been cleared if it 502 * triggered inside the kernel. 503 */ 504 if (current->thread.dabr) 505 set_dabr(current->thread.dabr); 506 |
507 /* Whee! Actually deliver the signal. */ |
|
540 ret = handle_signal(signr, &ka, &info, oldset, regs); 541 542 /* If a signal was successfully delivered, the saved sigmask is in 543 its frame, and we can clear the TIF_RESTORE_SIGMASK flag */ 544 if (ret && test_thread_flag(TIF_RESTORE_SIGMASK)) 545 clear_thread_flag(TIF_RESTORE_SIGMASK); 546 547 return ret; 548 } 549 | 508 ret = handle_signal(signr, &ka, &info, oldset, regs); 509 510 /* If a signal was successfully delivered, the saved sigmask is in 511 its frame, and we can clear the TIF_RESTORE_SIGMASK flag */ 512 if (ret && test_thread_flag(TIF_RESTORE_SIGMASK)) 513 clear_thread_flag(TIF_RESTORE_SIGMASK); 514 515 return ret; 516 } 517 |
550 if (TRAP(regs) == 0x0C00) { /* System Call! */ 551 if ((int)regs->result == -ERESTARTNOHAND || 552 (int)regs->result == -ERESTARTSYS || 553 (int)regs->result == -ERESTARTNOINTR) { 554 regs->gpr[3] = regs->orig_gpr3; 555 regs->nip -= 4; /* Back up & retry system call */ 556 regs->result = 0; 557 } else if ((int)regs->result == -ERESTART_RESTARTBLOCK) { 558 regs->gpr[0] = __NR_restart_syscall; 559 regs->nip -= 4; 560 regs->result = 0; 561 } 562 } | |
563 /* No signal to deliver -- put the saved sigmask back */ 564 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 565 clear_thread_flag(TIF_RESTORE_SIGMASK); 566 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); 567 } 568 569 return 0; 570} 571EXPORT_SYMBOL(do_signal); | 518 /* No signal to deliver -- put the saved sigmask back */ 519 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 520 clear_thread_flag(TIF_RESTORE_SIGMASK); 521 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); 522 } 523 524 return 0; 525} 526EXPORT_SYMBOL(do_signal); |