/* Atomically swap in the new signal mask, and wait for a signal.  */
asmlinkage long xtensa_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, long a2, long a3, long a4, long a5, struct pt_regs *regs)
/* Atomically swap in the new signal mask, and wait for a signal.  */
asmlinkage long xtensa_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, long a2, long a3, long a4, long a5, struct pt_regs *regs)
{
	sigset_t saveset, newset;
	if (sigsetsize != sizeof(sigset_t))
		return -EINVAL;
	if (copy_from_user(&newset, unewset, sizeof(newset)))
		return -EFAULT;
	sigdelsetmask(&newset, ~_BLOCKABLE);
	spin_lock_irq(&current->sighand->siglock);
	saveset = current->blocked;
	current->blocked = newset;
	recalc_sigpending();
	spin_unlock_irq(&current->sighand->siglock);
	regs->areg[2] = -EINTR;
	while (1) {
		current->state = TASK_INTERRUPTIBLE;
		schedule();
		if (do_signal(regs, &saveset))
			return -EINTR;
	}
}