#include <linux/smp_lock.h>
#include <linux/time.h>
#include <linux/ptrace.h>
+#include <linux/suspend.h>
#include <asm/ptrace.h>
#include <asm/uaccess.h>
__put_user((u64) regs->hi, &ctx->hi);
__put_user((u64) regs->lo, &ctx->lo);
__put_user((u64) regs->cp0_epc, &ctx->pc);
- __put_user(!!used_math(), &ctx->usedfp);
+ __put_user(current->used_math, &ctx->usedfp);
__put_user((u64) regs->cp0_cause, &ctx->cp0_cause);
__put_user((u64) regs->cp0_badvaddr, &ctx->cp0_badvaddr);
if (!user_mode(regs))
return 1;
- if (try_to_freeze(0))
+ if (current->flags & PF_FREEZE) {
+ refrigerator(0);
goto no_signal;
+ }
if (!oldset)
oldset = ¤t->blocked;
#endif
if (act) {
sigset_t mask;
- if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
+ if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags))
return -EFAULT;
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) {
- if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
+ if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &oact->sa_flags))
return -EFAULT;
asmlinkage int irix_sigprocmask(int how, irix_sigset_t *new, irix_sigset_t *old)
{
sigset_t oldbits, newbits;
+ int error;
if (new) {
- if (!access_ok(VERIFY_READ, new, sizeof(*new)))
- return -EFAULT;
+ error = verify_area(VERIFY_READ, new, sizeof(*new));
+ if (error)
+ return error;
__copy_from_user(&newbits, new, sizeof(unsigned long)*4);
sigdelsetmask(&newbits, ~_BLOCKABLE);
spin_unlock_irq(¤t->sighand->siglock);
}
if(old) {
- if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
- return -EFAULT;
+ error = verify_area(VERIFY_WRITE, old, sizeof(*old));
+ if(error)
+ return error;
__copy_to_user(old, ¤t->blocked, sizeof(unsigned long)*4);
}
#endif
/* Must always specify the signal set. */
- if (!set)
+ if(!set)
return -EINVAL;
- if (!access_ok(VERIFY_READ, set, sizeof(kset))) {
- error = -EFAULT;
+ error = verify_area(VERIFY_READ, set, sizeof(kset));
+ if (error)
goto out;
- }
__copy_from_user(&kset, set, sizeof(set));
if (error)
goto out;
}
- if (tp) {
- if (!access_ok(VERIFY_READ, tp, sizeof(*tp)))
- return -EFAULT;
- if (!tp->tv_sec && !tp->tv_nsec) {
+ if(tp) {
+ error = verify_area(VERIFY_READ, tp, sizeof(*tp));
+ if(error)
+ return error;
+ if(!tp->tv_sec && !tp->tv_nsec) {
error = -EINVAL;
goto out;
}
retval = -EINVAL;
goto out;
}
- if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) {
- retval = -EFAULT;
+ retval = verify_area(VERIFY_WRITE, info, sizeof(*info));
+ if(retval)
goto out;
- }
if (ru) {
- if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru))) {
- retval = -EFAULT;
+ retval = verify_area(VERIFY_WRITE, ru, sizeof(*ru));
+ if(retval)
goto out;
- }
}
if (options & ~(W_MASK)) {
retval = -EINVAL;
retval = -EINVAL;
goto out;
}
- add_wait_queue(¤t->signal->wait_chldexit, &wait);
+ add_wait_queue(¤t->wait_chldexit, &wait);
repeat:
flag = 0;
current->state = TASK_INTERRUPTIBLE;
}
goto end_waitsys;
- case EXIT_ZOMBIE:
+ case TASK_ZOMBIE:
current->signal->cutime += p->utime + p->signal->cutime;
current->signal->cstime += p->stime + p->signal->cstime;
if (ru != NULL)
retval = -ECHILD;
end_waitsys:
current->state = TASK_RUNNING;
- remove_wait_queue(¤t->signal->wait_chldexit, &wait);
+ remove_wait_queue(¤t->wait_chldexit, &wait);
out:
return retval;
asmlinkage int irix_getcontext(struct pt_regs *regs)
{
- int i, base = 0;
+ int error, i, base = 0;
struct irix5_context *ctx;
unsigned long flags;
current->comm, current->pid, ctx);
#endif
- if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx)))
- return -EFAULT;
-
+ error = verify_area(VERIFY_WRITE, ctx, sizeof(*ctx));
+ if(error)
+ goto out;
__put_user(current->thread.irix_oldctx, &ctx->link);
__copy_to_user(&ctx->sigmask, ¤t->blocked, sizeof(irix_sigset_t));
__put_user(regs->cp0_epc, &ctx->regs[35]);
flags = 0x0f;
- if (!used_math()) {
+ if(!current->used_math) {
flags &= ~(0x08);
} else {
/* XXX wheee... */
printk("Wheee, no code for saving IRIX FPU context yet.\n");
}
__put_user(flags, &ctx->flags);
+ error = 0;
- return 0;
+out:
+ return error;
}
asmlinkage unsigned long irix_setcontext(struct pt_regs *regs)
current->comm, current->pid, ctx);
#endif
- if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))) {
- error = -EFAULT;
+ error = verify_area(VERIFY_READ, ctx, sizeof(*ctx));
+ if (error)
goto out;
- }
if (ctx->flags & 0x02) {
/* XXX sigstack garbage, todo... */
asmlinkage int irix_sigstack(struct irix_sigstack *new, struct irix_sigstack *old)
{
- int error = -EFAULT;
+ int error;
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigstack(%p,%p)\n",
current->comm, current->pid, new, old);
#endif
if(new) {
- if (!access_ok(VERIFY_READ, new, sizeof(*new)))
+ error = verify_area(VERIFY_READ, new, sizeof(*new));
+ if(error)
goto out;
}
if(old) {
- if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
+ error = verify_area(VERIFY_WRITE, old, sizeof(*old));
+ if(error)
goto out;
}
error = 0;
asmlinkage int irix_sigaltstack(struct irix_sigaltstack *new,
struct irix_sigaltstack *old)
{
- int error = -EFAULT;
+ int error;
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigaltstack(%p,%p)\n",
current->comm, current->pid, new, old);
#endif
if (new) {
- if (!access_ok(VERIFY_READ, new, sizeof(*new)))
+ error = verify_area(VERIFY_READ, new, sizeof(*new));
+ if(error)
goto out;
}
if (old) {
- if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
+ error = verify_area(VERIFY_WRITE, old, sizeof(*old));
+ if(error)
goto out;
}
error = 0;
asmlinkage int irix_sigsendset(struct irix_procset *pset, int sig)
{
- if (!access_ok(VERIFY_READ, pset, sizeof(*pset)))
- return -EFAULT;
+ int error;
+ error = verify_area(VERIFY_READ, pset, sizeof(*pset));
+ if(error)
+ goto out;
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)\n",
current->comm, current->pid,
pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid,
sig);
#endif
- return -EINVAL;
+ error = -EINVAL;
+
+out:
+ return error;
}