Commit 47e12855 authored by Al Viro's avatar Al Viro

powerpc: switch to ->regset_get()

Note: compat variant of REGSET_TM_CGPR is almost certainly wrong;
it claims to be 48*64bit, but just as compat REGSET_GPR it stores
44*32bit of (truncated) registers + 4 32bit zeros... followed by
48 more 32bit zeroes.  Might be too late to change - it's a userland
ABI, after all ;-/
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0557d64d
...@@ -41,38 +41,25 @@ int vr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -41,38 +41,25 @@ int vr_active(struct task_struct *target, const struct user_regset *regset)
* }; * };
*/ */
int vr_get(struct task_struct *target, const struct user_regset *regset, int vr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
int ret; union {
elf_vrreg_t reg;
u32 word;
} vrsave;
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) != BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) !=
offsetof(struct thread_vr_state, vr[32])); offsetof(struct thread_vr_state, vr[32]));
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, membuf_write(&to, &target->thread.vr_state, 33 * sizeof(vector128));
&target->thread.vr_state, 0,
33 * sizeof(vector128));
if (!ret) {
/* /*
* Copy out only the low-order word of vrsave. * Copy out only the low-order word of vrsave.
*/ */
int start, end;
union {
elf_vrreg_t reg;
u32 word;
} vrsave;
memset(&vrsave, 0, sizeof(vrsave)); memset(&vrsave, 0, sizeof(vrsave));
vrsave.word = target->thread.vrsave; vrsave.word = target->thread.vrsave;
return membuf_write(&to, &vrsave, sizeof(vrsave));
start = 33 * sizeof(vector128);
end = start + sizeof(vrsave);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave,
start, end);
}
return ret;
} }
/* /*
......
...@@ -63,8 +63,7 @@ enum powerpc_regset { ...@@ -63,8 +63,7 @@ enum powerpc_regset {
/* ptrace-(no)vsx */ /* ptrace-(no)vsx */
int fpr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn fpr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int fpr_set(struct task_struct *target, const struct user_regset *regset, int fpr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
...@@ -72,8 +71,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -72,8 +71,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset,
/* ptrace-vsx */ /* ptrace-vsx */
int vsr_active(struct task_struct *target, const struct user_regset *regset); int vsr_active(struct task_struct *target, const struct user_regset *regset);
int vsr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn vsr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int vsr_set(struct task_struct *target, const struct user_regset *regset, int vsr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
...@@ -81,8 +79,7 @@ int vsr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -81,8 +79,7 @@ int vsr_set(struct task_struct *target, const struct user_regset *regset,
/* ptrace-altivec */ /* ptrace-altivec */
int vr_active(struct task_struct *target, const struct user_regset *regset); int vr_active(struct task_struct *target, const struct user_regset *regset);
int vr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn vr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int vr_set(struct task_struct *target, const struct user_regset *regset, int vr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
...@@ -90,8 +87,7 @@ int vr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -90,8 +87,7 @@ int vr_set(struct task_struct *target, const struct user_regset *regset,
/* ptrace-spe */ /* ptrace-spe */
int evr_active(struct task_struct *target, const struct user_regset *regset); int evr_active(struct task_struct *target, const struct user_regset *regset);
int evr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn evr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int evr_set(struct task_struct *target, const struct user_regset *regset, int evr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
...@@ -100,8 +96,7 @@ int evr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -100,8 +96,7 @@ int evr_set(struct task_struct *target, const struct user_regset *regset,
int gpr32_get_common(struct task_struct *target, int gpr32_get_common(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,
unsigned long *regs); unsigned long *regs);
int gpr32_set_common(struct task_struct *target, int gpr32_set_common(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
...@@ -118,55 +113,46 @@ static inline void flush_tmregs_to_thread(struct task_struct *tsk) { } ...@@ -118,55 +113,46 @@ static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
#endif #endif
int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset); int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset);
int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_cgpr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset, int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset); int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset);
int tm_cfpr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_cfpr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset, int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset); int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset);
int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_cvmx_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset, int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset); int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset);
int tm_cvsx_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_cvsx_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset, int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_spr_active(struct task_struct *target, const struct user_regset *regset); int tm_spr_active(struct task_struct *target, const struct user_regset *regset);
int tm_spr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_spr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_spr_set(struct task_struct *target, const struct user_regset *regset, int tm_spr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_tar_active(struct task_struct *target, const struct user_regset *regset); int tm_tar_active(struct task_struct *target, const struct user_regset *regset);
int tm_tar_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_tar_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_tar_set(struct task_struct *target, const struct user_regset *regset, int tm_tar_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_ppr_active(struct task_struct *target, const struct user_regset *regset); int tm_ppr_active(struct task_struct *target, const struct user_regset *regset);
int tm_ppr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_ppr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_ppr_set(struct task_struct *target, const struct user_regset *regset, int tm_ppr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_dscr_active(struct task_struct *target, const struct user_regset *regset); int tm_dscr_active(struct task_struct *target, const struct user_regset *regset);
int tm_dscr_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_dscr_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_dscr_set(struct task_struct *target, const struct user_regset *regset, int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset, user_regset_get2_fn tm_cgpr32_get;
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset, int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf); const void *kbuf, const void __user *ubuf);
......
...@@ -19,15 +19,14 @@ ...@@ -19,15 +19,14 @@
* }; * };
*/ */
int fpr_get(struct task_struct *target, const struct user_regset *regset, 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)
{ {
BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
offsetof(struct thread_fp_state, fpr[32])); offsetof(struct thread_fp_state, fpr[32]));
flush_fp_to_thread(target); flush_fp_to_thread(target);
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.fp_state, 33 * sizeof(u64));
&target->thread.fp_state, 0, -1);
} }
/* /*
......
...@@ -23,25 +23,17 @@ int evr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -23,25 +23,17 @@ int evr_active(struct task_struct *target, const struct user_regset *regset)
} }
int evr_get(struct task_struct *target, const struct user_regset *regset, int evr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
int ret;
flush_spe_to_thread(target); flush_spe_to_thread(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, membuf_write(&to, &target->thread.evr, sizeof(target->thread.evr));
&target->thread.evr,
0, sizeof(target->thread.evr));
BUILD_BUG_ON(offsetof(struct thread_struct, acc) + sizeof(u64) != BUILD_BUG_ON(offsetof(struct thread_struct, acc) + sizeof(u64) !=
offsetof(struct thread_struct, spefscr)); offsetof(struct thread_struct, spefscr));
if (!ret) return membuf_write(&to, &target->thread.acc,
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, sizeof(u64) + sizeof(u32));
&target->thread.acc,
sizeof(target->thread.evr), -1);
return ret;
} }
int evr_set(struct task_struct *target, const struct user_regset *regset, int evr_set(struct task_struct *target, const struct user_regset *regset,
......
This diff is collapsed.
This diff is collapsed.
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* }; * };
*/ */
int fpr_get(struct task_struct *target, const struct user_regset *regset, 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)
{ {
u64 buf[33]; u64 buf[33];
int i; int i;
...@@ -30,7 +30,7 @@ int fpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -30,7 +30,7 @@ int fpr_get(struct task_struct *target, const struct user_regset *regset,
for (i = 0; i < 32 ; i++) for (i = 0; i < 32 ; i++)
buf[i] = target->thread.TS_FPR(i); buf[i] = target->thread.TS_FPR(i);
buf[32] = target->thread.fp_state.fpscr; buf[32] = target->thread.fp_state.fpscr;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, buf, 0, -1); return membuf_write(&to, buf, 33 * sizeof(u64));
} }
/* /*
...@@ -95,10 +95,10 @@ int vsr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -95,10 +95,10 @@ int vsr_active(struct task_struct *target, const struct user_regset *regset)
* }; * };
*/ */
int vsr_get(struct task_struct *target, const struct user_regset *regset, int vsr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
u64 buf[32]; u64 buf[32];
int ret, i; int i;
flush_tmregs_to_thread(target); flush_tmregs_to_thread(target);
flush_fp_to_thread(target); flush_fp_to_thread(target);
...@@ -108,10 +108,7 @@ int vsr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -108,10 +108,7 @@ int vsr_get(struct task_struct *target, const struct user_regset *regset,
for (i = 0; i < 32 ; i++) for (i = 0; i < 32 ; i++)
buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET]; buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, buf, 32 * sizeof(double));
buf, 0, 32 * sizeof(double));
return ret;
} }
/* /*
......
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