/* SPU syscall restarting is tricky because we violate the basic assumption that the signal handler is running on the interrupted thread. Here instead, the handler runs on PowerPC user space code, while the syscall was called from the SPU. This means we can only do a very rough approximation of POSIX signal semantics.  */
static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret, unsigned int *npc)
/* SPU syscall restarting is tricky because we violate the basic assumption that the signal handler is running on the interrupted thread. Here instead, the handler runs on PowerPC user space code, while the syscall was called from the SPU. This means we can only do a very rough approximation of POSIX signal semantics.  */
static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret, unsigned int *npc)
{
	int ret;
	switch (*spu_ret) {
	case -ERESTARTSYS:
	case -ERESTARTNOINTR:
		*npc -= 8;
		ret = -ERESTARTSYS;
		break;
	case -ERESTARTNOHAND:
	case -ERESTART_RESTARTBLOCK:
		*spu_ret = -EINTR;
		ret = -ERESTARTSYS;
		break;
	default:
		printk(KERN_WARNING "%s: unexpected return code %ld\n",
			__func__, *spu_ret);
		ret = 0;
	}
	return ret;
}