X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fkernel%2Firixsig.c;h=298af9916db3226dc3e6a2f3f9871ad52874a29e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=223ca36ab8391a97a9f2427d40dfadd42c72ce7a;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 223ca36ab..298af9916 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c @@ -17,8 +17,6 @@ #include #include -extern asmlinkage void do_syscall_trace(void); - #undef DEBUG_SIG #define _S(nr) (1<<((nr)-1)) @@ -101,7 +99,7 @@ static void setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs, __put_user((u64) regs->hi, &ctx->hi); __put_user((u64) regs->lo, &ctx->lo); __put_user((u64) regs->cp0_epc, &ctx->pc); - __put_user(current->used_math, &ctx->usedfp); + __put_user(!!used_math(), &ctx->usedfp); __put_user((u64) regs->cp0_cause, &ctx->cp0_cause); __put_user((u64) regs->cp0_badvaddr, &ctx->cp0_badvaddr); @@ -122,9 +120,7 @@ static void setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs, return; segv_and_exit: - if (signr == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); + force_sigsegv(signr, current); } static void inline @@ -136,10 +132,8 @@ setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, } static inline void handle_signal(unsigned long sig, siginfo_t *info, - sigset_t *oldset, struct pt_regs * regs) + struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs) { - struct k_sigaction *ka = ¤t->sighand->action[sig-1]; - switch(regs->regs[0]) { case ERESTARTNOHAND: regs->regs[2] = EINTR; @@ -161,8 +155,6 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info, else setup_irix_frame(ka, regs, sig, oldset); - if (ka->sa.sa_flags & SA_ONESHOT) - ka->sa.sa_handler = SIG_DFL; if (!(ka->sa.sa_flags & SA_NODEFER)) { spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); @@ -174,18 +166,31 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info, asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs) { + struct k_sigaction ka; siginfo_t info; int signr; + /* + * We want the common case to go fast, which is why we may in certain + * cases get here from kernel mode. Just return without doing anything + * if so. + */ + if (!user_mode(regs)) + return 1; + + if (try_to_freeze(0)) + goto no_signal; + if (!oldset) oldset = ¤t->blocked; - signr = get_signal_to_deliver(&info, regs, NULL); + signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (signr > 0) { - handle_signal(signr, &info, oldset, regs); + handle_signal(signr, &info, &ka, oldset, regs); return 1; } +no_signal: /* * Who's code doesn't conform to the restartable syscall convention * dies here!!! The li instruction, a single machine instruction, @@ -263,7 +268,7 @@ irix_sigreturn(struct pt_regs *regs) * Don't let your children do this ... */ if (current_thread_info()->flags & TIF_SYSCALL_TRACE) - do_syscall_trace(); + do_syscall_trace(regs, 1); __asm__ __volatile__( "move\t$29,%0\n\t" "j\tsyscall_exit" @@ -532,11 +537,11 @@ out: } /* This is here because of irix5_siginfo definition. */ -#define P_PID 0 -#define P_PGID 2 -#define P_ALL 7 +#define IRIX_P_PID 0 +#define IRIX_P_PGID 2 +#define IRIX_P_ALL 7 -extern int getrusage(struct task_struct *, int, struct rusage *); +extern int getrusage(struct task_struct *, int, struct rusage __user *); #define W_EXITED 1 #define W_TRAPPED 2 @@ -571,11 +576,11 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info, retval = -EINVAL; goto out; } - if (type != P_PID && type != P_PGID && type != P_ALL) { + if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) { retval = -EINVAL; goto out; } - add_wait_queue(¤t->wait_chldexit, &wait); + add_wait_queue(¤t->signal->wait_chldexit, &wait); repeat: flag = 0; current->state = TASK_INTERRUPTIBLE; @@ -583,9 +588,9 @@ repeat: tsk = current; list_for_each(_p,&tsk->children) { p = list_entry(_p,struct task_struct,sibling); - if ((type == P_PID) && p->pid != pid) + if ((type == IRIX_P_PID) && p->pid != pid) continue; - if ((type == P_PGID) && process_group(p) != pid) + if ((type == IRIX_P_PGID) && process_group(p) != pid) continue; if ((p->exit_signal != SIGCHLD)) continue; @@ -619,9 +624,9 @@ repeat: } goto end_waitsys; - case TASK_ZOMBIE: - current->cutime += p->utime + p->cutime; - current->cstime += p->stime + p->cstime; + case EXIT_ZOMBIE: + current->signal->cutime += p->utime + p->signal->cutime; + current->signal->cstime += p->stime + p->signal->cstime; if (ru != NULL) getrusage(p, RUSAGE_BOTH, ru); __put_user(SIGCHLD, &info->sig); @@ -664,7 +669,7 @@ repeat: retval = -ECHILD; end_waitsys: current->state = TASK_RUNNING; - remove_wait_queue(¤t->wait_chldexit, &wait); + remove_wait_queue(¤t->signal->wait_chldexit, &wait); out: return retval; @@ -720,7 +725,7 @@ asmlinkage int irix_getcontext(struct pt_regs *regs) __put_user(regs->cp0_epc, &ctx->regs[35]); flags = 0x0f; - if(!current->used_math) { + if(!used_math()) { flags &= ~(0x08); } else { /* XXX wheee... */