Commit bd0409a8 authored by Al Viro's avatar Al Viro
Browse files

parisc: switch to ->regset_get()



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1b5b456e
Loading
Loading
Loading
Loading
+16 −68
Original line number Diff line number Diff line
@@ -391,31 +391,11 @@ void do_syscall_trace_exit(struct pt_regs *regs)

static int fpr_get(struct task_struct *target,
		     const struct user_regset *regset,
		     unsigned int pos, unsigned int count,
		     void *kbuf, void __user *ubuf)
		     struct membuf to)
{
	struct pt_regs *regs = task_regs(target);
	__u64 *k = kbuf;
	__u64 __user *u = ubuf;
	__u64 reg;

	pos /= sizeof(reg);
	count /= sizeof(reg);

	if (kbuf)
		for (; count > 0 && pos < ELF_NFPREG; --count)
			*k++ = regs->fr[pos++];
	else
		for (; count > 0 && pos < ELF_NFPREG; --count)
			if (__put_user(regs->fr[pos++], u++))
				return -EFAULT;

	kbuf = k;
	ubuf = u;
	pos *= sizeof(reg);
	count *= sizeof(reg);
	return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
					ELF_NFPREG * sizeof(reg), -1);
	return membuf_write(&to, regs->fr, ELF_NFPREG * sizeof(__u64));
}

static int fpr_set(struct task_struct *target,
@@ -527,30 +507,14 @@ static void set_reg(struct pt_regs *regs, int num, unsigned long val)

static int gpr_get(struct task_struct *target,
		     const struct user_regset *regset,
		     unsigned int pos, unsigned int count,
		     void *kbuf, void __user *ubuf)
		     struct membuf to)
{
	struct pt_regs *regs = task_regs(target);
	unsigned long *k = kbuf;
	unsigned long __user *u = ubuf;
	unsigned long reg;
	unsigned int pos;

	pos /= sizeof(reg);
	count /= sizeof(reg);

	if (kbuf)
		for (; count > 0 && pos < ELF_NGREG; --count)
			*k++ = get_reg(regs, pos++);
	else
		for (; count > 0 && pos < ELF_NGREG; --count)
			if (__put_user(get_reg(regs, pos++), u++))
				return -EFAULT;
	kbuf = k;
	ubuf = u;
	pos *= sizeof(reg);
	count *= sizeof(reg);
	return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
					ELF_NGREG * sizeof(reg), -1);
	for (pos = 0; pos < ELF_NGREG; pos++)
		membuf_store(&to, get_reg(regs, pos));
	return 0;
}

static int gpr_set(struct task_struct *target,
@@ -588,12 +552,12 @@ static const struct user_regset native_regsets[] = {
	[REGSET_GENERAL] = {
		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
		.size = sizeof(long), .align = sizeof(long),
		.get = gpr_get, .set = gpr_set
		.regset_get = gpr_get, .set = gpr_set
	},
	[REGSET_FP] = {
		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
		.size = sizeof(__u64), .align = sizeof(__u64),
		.get = fpr_get, .set = fpr_set
		.regset_get = fpr_get, .set = fpr_set
	}
};

@@ -607,31 +571,15 @@ static const struct user_regset_view user_parisc_native_view = {

static int gpr32_get(struct task_struct *target,
		     const struct user_regset *regset,
		     unsigned int pos, unsigned int count,
		     void *kbuf, void __user *ubuf)
		     struct membuf to)
{
	struct pt_regs *regs = task_regs(target);
	compat_ulong_t *k = kbuf;
	compat_ulong_t __user *u = ubuf;
	compat_ulong_t reg;

	pos /= sizeof(reg);
	count /= sizeof(reg);
	unsigned int pos;

	if (kbuf)
		for (; count > 0 && pos < ELF_NGREG; --count)
			*k++ = get_reg(regs, pos++);
	else
		for (; count > 0 && pos < ELF_NGREG; --count)
			if (__put_user((compat_ulong_t) get_reg(regs, pos++), u++))
				return -EFAULT;
	for (pos = 0; pos < ELF_NGREG; pos++)
		membuf_store(&to, (compat_ulong_t)get_reg(regs, pos));

	kbuf = k;
	ubuf = u;
	pos *= sizeof(reg);
	count *= sizeof(reg);
	return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
					ELF_NGREG * sizeof(reg), -1);
	return 0;
}

static int gpr32_set(struct task_struct *target,
@@ -672,12 +620,12 @@ static const struct user_regset compat_regsets[] = {
	[REGSET_GENERAL] = {
		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
		.size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
		.get = gpr32_get, .set = gpr32_set
		.regset_get = gpr32_get, .set = gpr32_set
	},
	[REGSET_FP] = {
		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
		.size = sizeof(__u64), .align = sizeof(__u64),
		.get = fpr_get, .set = fpr_set
		.regset_get = fpr_get, .set = fpr_set
	}
};