Commit bd0409a8 authored by Al Viro's avatar Al Viro

parisc: switch to ->regset_get()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1b5b456e
...@@ -391,31 +391,11 @@ void do_syscall_trace_exit(struct pt_regs *regs) ...@@ -391,31 +391,11 @@ void do_syscall_trace_exit(struct pt_regs *regs)
static int fpr_get(struct task_struct *target, static int fpr_get(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
unsigned int pos, unsigned int count, struct membuf to)
void *kbuf, void __user *ubuf)
{ {
struct pt_regs *regs = task_regs(target); 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; return membuf_write(&to, regs->fr, ELF_NFPREG * sizeof(__u64));
ubuf = u;
pos *= sizeof(reg);
count *= sizeof(reg);
return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
ELF_NFPREG * sizeof(reg), -1);
} }
static int fpr_set(struct task_struct *target, 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) ...@@ -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, static int gpr_get(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
unsigned int pos, unsigned int count, struct membuf to)
void *kbuf, void __user *ubuf)
{ {
struct pt_regs *regs = task_regs(target); struct pt_regs *regs = task_regs(target);
unsigned long *k = kbuf; unsigned int pos;
unsigned long __user *u = ubuf;
unsigned long reg;
pos /= sizeof(reg); for (pos = 0; pos < ELF_NGREG; pos++)
count /= sizeof(reg); membuf_store(&to, get_reg(regs, pos));
return 0;
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);
} }
static int gpr_set(struct task_struct *target, static int gpr_set(struct task_struct *target,
...@@ -588,12 +552,12 @@ static const struct user_regset native_regsets[] = { ...@@ -588,12 +552,12 @@ static const struct user_regset native_regsets[] = {
[REGSET_GENERAL] = { [REGSET_GENERAL] = {
.core_note_type = NT_PRSTATUS, .n = ELF_NGREG, .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
.size = sizeof(long), .align = sizeof(long), .size = sizeof(long), .align = sizeof(long),
.get = gpr_get, .set = gpr_set .regset_get = gpr_get, .set = gpr_set
}, },
[REGSET_FP] = { [REGSET_FP] = {
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG, .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
.size = sizeof(__u64), .align = sizeof(__u64), .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 = { ...@@ -607,31 +571,15 @@ static const struct user_regset_view user_parisc_native_view = {
static int gpr32_get(struct task_struct *target, static int gpr32_get(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
unsigned int pos, unsigned int count, struct membuf to)
void *kbuf, void __user *ubuf)
{ {
struct pt_regs *regs = task_regs(target); struct pt_regs *regs = task_regs(target);
compat_ulong_t *k = kbuf; unsigned int pos;
compat_ulong_t __user *u = ubuf;
compat_ulong_t reg;
pos /= sizeof(reg); for (pos = 0; pos < ELF_NGREG; pos++)
count /= sizeof(reg); membuf_store(&to, (compat_ulong_t)get_reg(regs, pos));
if (kbuf) return 0;
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;
kbuf = k;
ubuf = u;
pos *= sizeof(reg);
count *= sizeof(reg);
return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
ELF_NGREG * sizeof(reg), -1);
} }
static int gpr32_set(struct task_struct *target, static int gpr32_set(struct task_struct *target,
...@@ -672,12 +620,12 @@ static const struct user_regset compat_regsets[] = { ...@@ -672,12 +620,12 @@ static const struct user_regset compat_regsets[] = {
[REGSET_GENERAL] = { [REGSET_GENERAL] = {
.core_note_type = NT_PRSTATUS, .n = ELF_NGREG, .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
.size = sizeof(compat_long_t), .align = sizeof(compat_long_t), .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] = { [REGSET_FP] = {
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG, .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
.size = sizeof(__u64), .align = sizeof(__u64), .size = sizeof(__u64), .align = sizeof(__u64),
.get = fpr_get, .set = fpr_set .regset_get = fpr_get, .set = fpr_set
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment