/* Emulate floating-point pair loads and stores. Only POWER6 has these instructions, and it does true little-endian, so we don't need the address swizzling.  */
static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, unsigned int flags)
/* Emulate floating-point pair loads and stores. Only POWER6 has these instructions, and it does true little-endian, so we don't need the address swizzling.  */
static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, unsigned int flags)
{
	char *ptr0 = (char *) &current->thread.TS_FPR(reg);
	char *ptr1 = (char *) &current->thread.TS_FPR(reg+1);
	int i, ret, sw = 0;
	if (!(flags & F))
		return 0;
	if (reg & 1)
		return 0;
	if (flags & SW)
		sw = 7;
	ret = 0;
	for (i = 0; i < 8; ++i) {
		if (!(flags & ST)) {
			ret |= __get_user(ptr0[i^sw], addr + i);
			ret |= __get_user(ptr1[i^sw], addr + i + 8);
		} else {
			ret |= __put_user(ptr0[i^sw], addr + i);
			ret |= __put_user(ptr1[i^sw], addr + i + 8);
		}
	}
	if (ret)
		return -EFAULT;
	return 1;
}