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,
......
...@@ -70,10 +70,7 @@ int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -70,10 +70,7 @@ int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset)
* tm_cgpr_get - get CGPR registers * tm_cgpr_get - get CGPR registers
* @target: The target task. * @target: The target task.
* @regset: The user regset structure. * @regset: The user regset structure.
* @pos: The buffer position. * @to: Destination of copy.
* @count: Number of bytes to copy.
* @kbuf: Kernel buffer to copy from.
* @ubuf: User buffer to copy into.
* *
* This function gets transaction checkpointed GPR registers. * This function gets transaction checkpointed GPR registers.
* *
...@@ -87,10 +84,8 @@ int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -87,10 +84,8 @@ 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, int tm_cgpr_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;
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
...@@ -101,31 +96,18 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -101,31 +96,18 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
flush_fp_to_thread(target); flush_fp_to_thread(target);
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, membuf_write(&to, &target->thread.ckpt_regs,
&target->thread.ckpt_regs, offsetof(struct pt_regs, msr));
0, offsetof(struct pt_regs, msr)); membuf_store(&to, get_user_ckpt_msr(target));
if (!ret) {
unsigned long msr = get_user_ckpt_msr(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &msr,
offsetof(struct pt_regs, msr),
offsetof(struct pt_regs, msr) +
sizeof(msr));
}
BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) != BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
offsetof(struct pt_regs, msr) + sizeof(long)); offsetof(struct pt_regs, msr) + sizeof(long));
if (!ret) membuf_write(&to, &target->thread.ckpt_regs.orig_gpr3,
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, sizeof(struct user_pt_regs) -
&target->thread.ckpt_regs.orig_gpr3, offsetof(struct pt_regs, orig_gpr3));
offsetof(struct pt_regs, orig_gpr3), return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
sizeof(struct user_pt_regs)); sizeof(struct user_pt_regs));
if (!ret)
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
sizeof(struct user_pt_regs), -1);
return ret;
} }
/* /*
...@@ -229,10 +211,7 @@ int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -229,10 +211,7 @@ int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset)
* tm_cfpr_get - get CFPR registers * tm_cfpr_get - get CFPR registers
* @target: The target task. * @target: The target task.
* @regset: The user regset structure. * @regset: The user regset structure.
* @pos: The buffer position. * @to: Destination of copy.
* @count: Number of bytes to copy.
* @kbuf: Kernel buffer to copy from.
* @ubuf: User buffer to copy into.
* *
* This function gets in transaction checkpointed FPR registers. * This function gets in transaction checkpointed FPR registers.
* *
...@@ -247,7 +226,7 @@ int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -247,7 +226,7 @@ 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, int tm_cfpr_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;
...@@ -266,7 +245,7 @@ int tm_cfpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -266,7 +245,7 @@ int tm_cfpr_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_CKFPR(i); buf[i] = target->thread.TS_CKFPR(i);
buf[32] = target->thread.ckfp_state.fpscr; buf[32] = target->thread.ckfp_state.fpscr;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, buf, 0, -1); return membuf_write(&to, buf, sizeof(buf));
} }
/** /**
...@@ -344,10 +323,7 @@ int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset) ...@@ -344,10 +323,7 @@ int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset)
* tm_cvmx_get - get CMVX registers * tm_cvmx_get - get CMVX registers
* @target: The target task. * @target: The target task.
* @regset: The user regset structure. * @regset: The user regset structure.
* @pos: The buffer position. * @to: Destination of copy.
* @count: Number of bytes to copy.
* @kbuf: Kernel buffer to copy from.
* @ubuf: User buffer to copy into.
* *
* This function gets in transaction checkpointed VMX registers. * This function gets in transaction checkpointed VMX registers.
* *
...@@ -363,10 +339,12 @@ int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset) ...@@ -363,10 +339,12 @@ 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, int tm_cvmx_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;
BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32])); BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32]));
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
...@@ -380,23 +358,13 @@ int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset, ...@@ -380,23 +358,13 @@ int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset,
flush_fp_to_thread(target); flush_fp_to_thread(target);
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.ckvr_state, membuf_write(&to, &target->thread.ckvr_state, 33 * sizeof(vector128));
0, 33 * sizeof(vector128));
if (!ret) {
/* /*
* Copy out only the low-order word of vrsave. * Copy out only the low-order word of vrsave.
*/ */
union {
elf_vrreg_t reg;
u32 word;
} vrsave;
memset(&vrsave, 0, sizeof(vrsave)); memset(&vrsave, 0, sizeof(vrsave));
vrsave.word = target->thread.ckvrsave; vrsave.word = target->thread.ckvrsave;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave, return membuf_write(&to, &vrsave, sizeof(vrsave));
33 * sizeof(vector128), -1);
}
return ret;
} }
/** /**
...@@ -484,10 +452,7 @@ int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset) ...@@ -484,10 +452,7 @@ int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset)
* tm_cvsx_get - get CVSX registers * tm_cvsx_get - get CVSX registers
* @target: The target task. * @target: The target task.
* @regset: The user regset structure. * @regset: The user regset structure.
* @pos: The buffer position. * @to: Destination of copy.
* @count: Number of bytes to copy.
* @kbuf: Kernel buffer to copy from.
* @ubuf: User buffer to copy into.
* *
* This function gets in transaction checkpointed VSX registers. * This function gets in transaction checkpointed VSX registers.
* *
...@@ -501,10 +466,10 @@ int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset) ...@@ -501,10 +466,10 @@ 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, int tm_cvsx_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;
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
...@@ -520,10 +485,7 @@ int tm_cvsx_get(struct task_struct *target, const struct user_regset *regset, ...@@ -520,10 +485,7 @@ int tm_cvsx_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.ckfp_state.fpr[i][TS_VSRLOWOFFSET]; buf[i] = target->thread.ckfp_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;
} }
/** /**
...@@ -597,10 +559,7 @@ int tm_spr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -597,10 +559,7 @@ int tm_spr_active(struct task_struct *target, const struct user_regset *regset)
* tm_spr_get - get the TM related SPR registers * tm_spr_get - get the TM related SPR registers
* @target: The target task. * @target: The target task.
* @regset: The user regset structure. * @regset: The user regset structure.
* @pos: The buffer position. * @to: Destination of copy.
* @count: Number of bytes to copy.
* @kbuf: Kernel buffer to copy from.
* @ubuf: User buffer to copy into.
* *
* This function gets transactional memory related SPR registers. * This function gets transactional memory related SPR registers.
* The userspace interface buffer layout is as follows. * The userspace interface buffer layout is as follows.
...@@ -612,10 +571,8 @@ int tm_spr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -612,10 +571,8 @@ 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, int tm_spr_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;
/* Build tests */ /* Build tests */
BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr)); BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr));
BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar)); BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar));
...@@ -630,21 +587,11 @@ int tm_spr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -630,21 +587,11 @@ int tm_spr_get(struct task_struct *target, const struct user_regset *regset,
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
/* TFHAR register */ /* TFHAR register */
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, membuf_write(&to, &target->thread.tm_tfhar, sizeof(u64));
&target->thread.tm_tfhar, 0, sizeof(u64));
/* TEXASR register */ /* TEXASR register */
if (!ret) membuf_write(&to, &target->thread.tm_texasr, sizeof(u64));
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&target->thread.tm_texasr, sizeof(u64),
2 * sizeof(u64));
/* TFIAR register */ /* TFIAR register */
if (!ret) return membuf_write(&to, &target->thread.tm_tfiar, sizeof(u64));
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&target->thread.tm_tfiar,
2 * sizeof(u64), 3 * sizeof(u64));
return ret;
} }
/** /**
...@@ -714,19 +661,15 @@ int tm_tar_active(struct task_struct *target, const struct user_regset *regset) ...@@ -714,19 +661,15 @@ 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, int tm_tar_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;
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
if (!MSR_TM_ACTIVE(target->thread.regs->msr)) if (!MSR_TM_ACTIVE(target->thread.regs->msr))
return -ENODATA; return -ENODATA;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.tm_tar, sizeof(u64));
&target->thread.tm_tar, 0, sizeof(u64));
return ret;
} }
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,
...@@ -759,19 +702,15 @@ int tm_ppr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -759,19 +702,15 @@ 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, int tm_ppr_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;
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
if (!MSR_TM_ACTIVE(target->thread.regs->msr)) if (!MSR_TM_ACTIVE(target->thread.regs->msr))
return -ENODATA; return -ENODATA;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.tm_ppr, sizeof(u64));
&target->thread.tm_ppr, 0, sizeof(u64));
return ret;
} }
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,
...@@ -803,19 +742,15 @@ int tm_dscr_active(struct task_struct *target, const struct user_regset *regset) ...@@ -803,19 +742,15 @@ 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, int tm_dscr_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;
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
if (!MSR_TM_ACTIVE(target->thread.regs->msr)) if (!MSR_TM_ACTIVE(target->thread.regs->msr))
return -ENODATA; return -ENODATA;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.tm_dscr, sizeof(u64));
&target->thread.tm_dscr, 0, sizeof(u64));
return ret;
} }
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,
...@@ -836,10 +771,11 @@ int tm_dscr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -836,10 +771,11 @@ int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
} }
int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset, int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
return gpr32_get_common(target, regset, pos, count, kbuf, ubuf, gpr32_get_common(target, regset, to,
&target->thread.ckpt_regs.gpr[0]); &target->thread.ckpt_regs.gpr[0]);
return membuf_zero(&to, ELF_NGREG * sizeof(u32));
} }
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,
......
...@@ -215,9 +215,9 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data) ...@@ -215,9 +215,9 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)
} }
static int gpr_get(struct task_struct *target, const struct user_regset *regset, 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)
{ {
int i, ret; int i;
if (target->thread.regs == NULL) if (target->thread.regs == NULL)
return -EIO; return -EIO;
...@@ -228,30 +228,17 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -228,30 +228,17 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
target->thread.regs->gpr[i] = NV_REG_POISON; target->thread.regs->gpr[i] = NV_REG_POISON;
} }
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, membuf_write(&to, target->thread.regs, offsetof(struct pt_regs, msr));
target->thread.regs, membuf_store(&to, get_user_msr(target));
0, offsetof(struct pt_regs, msr));
if (!ret) {
unsigned long msr = get_user_msr(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &msr,
offsetof(struct pt_regs, msr),
offsetof(struct pt_regs, msr) +
sizeof(msr));
}
BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) != BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
offsetof(struct pt_regs, msr) + sizeof(long)); offsetof(struct pt_regs, msr) + sizeof(long));
if (!ret) membuf_write(&to, &target->thread.regs->orig_gpr3,
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, sizeof(struct user_pt_regs) -
&target->thread.regs->orig_gpr3, offsetof(struct pt_regs, orig_gpr3));
offsetof(struct pt_regs, orig_gpr3), return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
sizeof(struct user_pt_regs)); sizeof(struct user_pt_regs));
if (!ret)
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
sizeof(struct user_pt_regs), -1);
return ret;
} }
static int gpr_set(struct task_struct *target, const struct user_regset *regset, static int gpr_set(struct task_struct *target, const struct user_regset *regset,
...@@ -309,10 +296,9 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -309,10 +296,9 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset,
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
static int ppr_get(struct task_struct *target, const struct user_regset *regset, static int ppr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.regs->ppr, sizeof(u64));
&target->thread.regs->ppr, 0, sizeof(u64));
} }
static int ppr_set(struct task_struct *target, const struct user_regset *regset, static int ppr_set(struct task_struct *target, const struct user_regset *regset,
...@@ -324,10 +310,9 @@ static int ppr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -324,10 +310,9 @@ static int ppr_set(struct task_struct *target, const struct user_regset *regset,
} }
static int dscr_get(struct task_struct *target, const struct user_regset *regset, static int dscr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.dscr, sizeof(u64));
&target->thread.dscr, 0, sizeof(u64));
} }
static int dscr_set(struct task_struct *target, const struct user_regset *regset, static int dscr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, const void *kbuf, unsigned int pos, unsigned int count, const void *kbuf,
...@@ -339,10 +324,9 @@ static int dscr_set(struct task_struct *target, const struct user_regset *regset ...@@ -339,10 +324,9 @@ static int dscr_set(struct task_struct *target, const struct user_regset *regset
#endif #endif
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
static int tar_get(struct task_struct *target, const struct user_regset *regset, static int tar_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) struct membuf to)
{ {
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, return membuf_write(&to, &target->thread.tar, sizeof(u64));
&target->thread.tar, 0, sizeof(u64));
} }
static int tar_set(struct task_struct *target, const struct user_regset *regset, static int tar_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, const void *kbuf, unsigned int pos, unsigned int count, const void *kbuf,
...@@ -364,7 +348,7 @@ static int ebb_active(struct task_struct *target, const struct user_regset *regs ...@@ -364,7 +348,7 @@ static int ebb_active(struct task_struct *target, const struct user_regset *regs
} }
static int ebb_get(struct task_struct *target, const struct user_regset *regset, static int ebb_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 tests */ /* Build tests */
BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr)); BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr));
...@@ -376,8 +360,7 @@ static int ebb_get(struct task_struct *target, const struct user_regset *regset, ...@@ -376,8 +360,7 @@ static int ebb_get(struct task_struct *target, const struct user_regset *regset,
if (!target->thread.used_ebb) if (!target->thread.used_ebb)
return -ENODATA; return -ENODATA;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.ebbrr, return membuf_write(&to, &target->thread.ebbrr, 3 * sizeof(unsigned long));
0, 3 * sizeof(unsigned long));
} }
static int ebb_set(struct task_struct *target, const struct user_regset *regset, static int ebb_set(struct task_struct *target, const struct user_regset *regset,
...@@ -420,7 +403,7 @@ static int pmu_active(struct task_struct *target, const struct user_regset *regs ...@@ -420,7 +403,7 @@ static int pmu_active(struct task_struct *target, const struct user_regset *regs
} }
static int pmu_get(struct task_struct *target, const struct user_regset *regset, static int pmu_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 tests */ /* Build tests */
BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar)); BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
...@@ -431,8 +414,7 @@ static int pmu_get(struct task_struct *target, const struct user_regset *regset, ...@@ -431,8 +414,7 @@ static int pmu_get(struct task_struct *target, const struct user_regset *regset,
if (!cpu_has_feature(CPU_FTR_ARCH_207S)) if (!cpu_has_feature(CPU_FTR_ARCH_207S))
return -ENODEV; return -ENODEV;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.siar, return membuf_write(&to, &target->thread.siar, 5 * sizeof(unsigned long));
0, 5 * sizeof(unsigned long));
} }
static int pmu_set(struct task_struct *target, const struct user_regset *regset, static int pmu_set(struct task_struct *target, const struct user_regset *regset,
...@@ -486,7 +468,7 @@ static int pkey_active(struct task_struct *target, const struct user_regset *reg ...@@ -486,7 +468,7 @@ static int pkey_active(struct task_struct *target, const struct user_regset *reg
} }
static int pkey_get(struct task_struct *target, const struct user_regset *regset, static int pkey_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(TSO(amr) + sizeof(unsigned long) != TSO(iamr)); BUILD_BUG_ON(TSO(amr) + sizeof(unsigned long) != TSO(iamr));
BUILD_BUG_ON(TSO(iamr) + sizeof(unsigned long) != TSO(uamor)); BUILD_BUG_ON(TSO(iamr) + sizeof(unsigned long) != TSO(uamor));
...@@ -494,8 +476,7 @@ static int pkey_get(struct task_struct *target, const struct user_regset *regset ...@@ -494,8 +476,7 @@ static int pkey_get(struct task_struct *target, const struct user_regset *regset
if (!arch_pkeys_enabled()) if (!arch_pkeys_enabled())
return -ENODEV; return -ENODEV;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.amr, return membuf_write(&to, &target->thread.amr, ELF_NPKEY * sizeof(unsigned long));
0, ELF_NPKEY * sizeof(unsigned long));
} }
static int pkey_set(struct task_struct *target, const struct user_regset *regset, static int pkey_set(struct task_struct *target, const struct user_regset *regset,
...@@ -529,110 +510,110 @@ static const struct user_regset native_regsets[] = { ...@@ -529,110 +510,110 @@ static const struct user_regset native_regsets[] = {
[REGSET_GPR] = { [REGSET_GPR] = {
.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_FPR] = { [REGSET_FPR] = {
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG, .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.get = fpr_get, .set = fpr_set .regset_get = fpr_get, .set = fpr_set
}, },
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
[REGSET_VMX] = { [REGSET_VMX] = {
.core_note_type = NT_PPC_VMX, .n = 34, .core_note_type = NT_PPC_VMX, .n = 34,
.size = sizeof(vector128), .align = sizeof(vector128), .size = sizeof(vector128), .align = sizeof(vector128),
.active = vr_active, .get = vr_get, .set = vr_set .active = vr_active, .regset_get = vr_get, .set = vr_set
}, },
#endif #endif
#ifdef CONFIG_VSX #ifdef CONFIG_VSX
[REGSET_VSX] = { [REGSET_VSX] = {
.core_note_type = NT_PPC_VSX, .n = 32, .core_note_type = NT_PPC_VSX, .n = 32,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.active = vsr_active, .get = vsr_get, .set = vsr_set .active = vsr_active, .regset_get = vsr_get, .set = vsr_set
}, },
#endif #endif
#ifdef CONFIG_SPE #ifdef CONFIG_SPE
[REGSET_SPE] = { [REGSET_SPE] = {
.core_note_type = NT_PPC_SPE, .n = 35, .core_note_type = NT_PPC_SPE, .n = 35,
.size = sizeof(u32), .align = sizeof(u32), .size = sizeof(u32), .align = sizeof(u32),
.active = evr_active, .get = evr_get, .set = evr_set .active = evr_active, .regset_get = evr_get, .set = evr_set
}, },
#endif #endif
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
[REGSET_TM_CGPR] = { [REGSET_TM_CGPR] = {
.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG, .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
.size = sizeof(long), .align = sizeof(long), .size = sizeof(long), .align = sizeof(long),
.active = tm_cgpr_active, .get = tm_cgpr_get, .set = tm_cgpr_set .active = tm_cgpr_active, .regset_get = tm_cgpr_get, .set = tm_cgpr_set
}, },
[REGSET_TM_CFPR] = { [REGSET_TM_CFPR] = {
.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG, .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.active = tm_cfpr_active, .get = tm_cfpr_get, .set = tm_cfpr_set .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
}, },
[REGSET_TM_CVMX] = { [REGSET_TM_CVMX] = {
.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX, .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
.size = sizeof(vector128), .align = sizeof(vector128), .size = sizeof(vector128), .align = sizeof(vector128),
.active = tm_cvmx_active, .get = tm_cvmx_get, .set = tm_cvmx_set .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
}, },
[REGSET_TM_CVSX] = { [REGSET_TM_CVSX] = {
.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX, .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.active = tm_cvsx_active, .get = tm_cvsx_get, .set = tm_cvsx_set .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
}, },
[REGSET_TM_SPR] = { [REGSET_TM_SPR] = {
.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG, .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_spr_active, .get = tm_spr_get, .set = tm_spr_set .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
}, },
[REGSET_TM_CTAR] = { [REGSET_TM_CTAR] = {
.core_note_type = NT_PPC_TM_CTAR, .n = 1, .core_note_type = NT_PPC_TM_CTAR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_tar_active, .get = tm_tar_get, .set = tm_tar_set .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
}, },
[REGSET_TM_CPPR] = { [REGSET_TM_CPPR] = {
.core_note_type = NT_PPC_TM_CPPR, .n = 1, .core_note_type = NT_PPC_TM_CPPR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_ppr_active, .get = tm_ppr_get, .set = tm_ppr_set .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
}, },
[REGSET_TM_CDSCR] = { [REGSET_TM_CDSCR] = {
.core_note_type = NT_PPC_TM_CDSCR, .n = 1, .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_dscr_active, .get = tm_dscr_get, .set = tm_dscr_set .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
}, },
#endif #endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
[REGSET_PPR] = { [REGSET_PPR] = {
.core_note_type = NT_PPC_PPR, .n = 1, .core_note_type = NT_PPC_PPR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = ppr_get, .set = ppr_set .regset_get = ppr_get, .set = ppr_set
}, },
[REGSET_DSCR] = { [REGSET_DSCR] = {
.core_note_type = NT_PPC_DSCR, .n = 1, .core_note_type = NT_PPC_DSCR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = dscr_get, .set = dscr_set .regset_get = dscr_get, .set = dscr_set
}, },
#endif #endif
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
[REGSET_TAR] = { [REGSET_TAR] = {
.core_note_type = NT_PPC_TAR, .n = 1, .core_note_type = NT_PPC_TAR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = tar_get, .set = tar_set .regset_get = tar_get, .set = tar_set
}, },
[REGSET_EBB] = { [REGSET_EBB] = {
.core_note_type = NT_PPC_EBB, .n = ELF_NEBB, .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = ebb_active, .get = ebb_get, .set = ebb_set .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
}, },
[REGSET_PMR] = { [REGSET_PMR] = {
.core_note_type = NT_PPC_PMU, .n = ELF_NPMU, .core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = pmu_active, .get = pmu_get, .set = pmu_set .active = pmu_active, .regset_get = pmu_get, .set = pmu_set
}, },
#endif #endif
#ifdef CONFIG_PPC_MEM_KEYS #ifdef CONFIG_PPC_MEM_KEYS
[REGSET_PKEY] = { [REGSET_PKEY] = {
.core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY, .core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = pkey_active, .get = pkey_get, .set = pkey_set .active = pkey_active, .regset_get = pkey_get, .set = pkey_set
}, },
#endif #endif
}; };
...@@ -646,49 +627,16 @@ const struct user_regset_view user_ppc_native_view = { ...@@ -646,49 +627,16 @@ const struct user_regset_view user_ppc_native_view = {
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, unsigned long *regs)
void *kbuf, void __user *ubuf,
unsigned long *regs)
{ {
compat_ulong_t *k = kbuf; int i;
compat_ulong_t __user *u = ubuf;
compat_ulong_t reg;
pos /= sizeof(reg);
count /= sizeof(reg);
if (kbuf)
for (; count > 0 && pos < PT_MSR; --count)
*k++ = regs[pos++];
else
for (; count > 0 && pos < PT_MSR; --count)
if (__put_user((compat_ulong_t)regs[pos++], u++))
return -EFAULT;
if (count > 0 && pos == PT_MSR) {
reg = get_user_msr(target);
if (kbuf)
*k++ = reg;
else if (__put_user(reg, u++))
return -EFAULT;
++pos;
--count;
}
if (kbuf)
for (; count > 0 && pos < PT_REGS_COUNT; --count)
*k++ = regs[pos++];
else
for (; count > 0 && pos < PT_REGS_COUNT; --count)
if (__put_user((compat_ulong_t)regs[pos++], u++))
return -EFAULT;
kbuf = k; for (i = 0; i < PT_MSR; i++)
ubuf = u; membuf_store(&to, (u32)regs[i]);
pos *= sizeof(reg); membuf_store(&to, (u32)get_user_msr(target));
count *= sizeof(reg); for (i++ ; i < PT_REGS_COUNT; i++)
return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, membuf_store(&to, (u32)regs[i]);
PT_REGS_COUNT * sizeof(reg), -1); return membuf_zero(&to, (ELF_NGREG - PT_REGS_COUNT) * sizeof(u32));
} }
int gpr32_set_common(struct task_struct *target, int gpr32_set_common(struct task_struct *target,
...@@ -761,8 +709,7 @@ int gpr32_set_common(struct task_struct *target, ...@@ -761,8 +709,7 @@ int gpr32_set_common(struct task_struct *target,
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)
{ {
int i; int i;
...@@ -777,7 +724,7 @@ static int gpr32_get(struct task_struct *target, ...@@ -777,7 +724,7 @@ static int gpr32_get(struct task_struct *target,
for (i = 14; i < 32; i++) for (i = 14; i < 32; i++)
target->thread.regs->gpr[i] = NV_REG_POISON; target->thread.regs->gpr[i] = NV_REG_POISON;
} }
return gpr32_get_common(target, regset, pos, count, kbuf, ubuf, return gpr32_get_common(target, regset, to,
&target->thread.regs->gpr[0]); &target->thread.regs->gpr[0]);
} }
...@@ -801,25 +748,25 @@ static const struct user_regset compat_regsets[] = { ...@@ -801,25 +748,25 @@ static const struct user_regset compat_regsets[] = {
[REGSET_GPR] = { [REGSET_GPR] = {
.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_FPR] = { [REGSET_FPR] = {
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG, .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.get = fpr_get, .set = fpr_set .regset_get = fpr_get, .set = fpr_set
}, },
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
[REGSET_VMX] = { [REGSET_VMX] = {
.core_note_type = NT_PPC_VMX, .n = 34, .core_note_type = NT_PPC_VMX, .n = 34,
.size = sizeof(vector128), .align = sizeof(vector128), .size = sizeof(vector128), .align = sizeof(vector128),
.active = vr_active, .get = vr_get, .set = vr_set .active = vr_active, .regset_get = vr_get, .set = vr_set
}, },
#endif #endif
#ifdef CONFIG_SPE #ifdef CONFIG_SPE
[REGSET_SPE] = { [REGSET_SPE] = {
.core_note_type = NT_PPC_SPE, .n = 35, .core_note_type = NT_PPC_SPE, .n = 35,
.size = sizeof(u32), .align = sizeof(u32), .size = sizeof(u32), .align = sizeof(u32),
.active = evr_active, .get = evr_get, .set = evr_set .active = evr_active, .regset_get = evr_get, .set = evr_set
}, },
#endif #endif
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
...@@ -827,66 +774,66 @@ static const struct user_regset compat_regsets[] = { ...@@ -827,66 +774,66 @@ static const struct user_regset compat_regsets[] = {
.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG, .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
.size = sizeof(long), .align = sizeof(long), .size = sizeof(long), .align = sizeof(long),
.active = tm_cgpr_active, .active = tm_cgpr_active,
.get = tm_cgpr32_get, .set = tm_cgpr32_set .regset_get = tm_cgpr32_get, .set = tm_cgpr32_set
}, },
[REGSET_TM_CFPR] = { [REGSET_TM_CFPR] = {
.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG, .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.active = tm_cfpr_active, .get = tm_cfpr_get, .set = tm_cfpr_set .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
}, },
[REGSET_TM_CVMX] = { [REGSET_TM_CVMX] = {
.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX, .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
.size = sizeof(vector128), .align = sizeof(vector128), .size = sizeof(vector128), .align = sizeof(vector128),
.active = tm_cvmx_active, .get = tm_cvmx_get, .set = tm_cvmx_set .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
}, },
[REGSET_TM_CVSX] = { [REGSET_TM_CVSX] = {
.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX, .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
.size = sizeof(double), .align = sizeof(double), .size = sizeof(double), .align = sizeof(double),
.active = tm_cvsx_active, .get = tm_cvsx_get, .set = tm_cvsx_set .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
}, },
[REGSET_TM_SPR] = { [REGSET_TM_SPR] = {
.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG, .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_spr_active, .get = tm_spr_get, .set = tm_spr_set .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
}, },
[REGSET_TM_CTAR] = { [REGSET_TM_CTAR] = {
.core_note_type = NT_PPC_TM_CTAR, .n = 1, .core_note_type = NT_PPC_TM_CTAR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_tar_active, .get = tm_tar_get, .set = tm_tar_set .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
}, },
[REGSET_TM_CPPR] = { [REGSET_TM_CPPR] = {
.core_note_type = NT_PPC_TM_CPPR, .n = 1, .core_note_type = NT_PPC_TM_CPPR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_ppr_active, .get = tm_ppr_get, .set = tm_ppr_set .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
}, },
[REGSET_TM_CDSCR] = { [REGSET_TM_CDSCR] = {
.core_note_type = NT_PPC_TM_CDSCR, .n = 1, .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = tm_dscr_active, .get = tm_dscr_get, .set = tm_dscr_set .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
}, },
#endif #endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
[REGSET_PPR] = { [REGSET_PPR] = {
.core_note_type = NT_PPC_PPR, .n = 1, .core_note_type = NT_PPC_PPR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = ppr_get, .set = ppr_set .regset_get = ppr_get, .set = ppr_set
}, },
[REGSET_DSCR] = { [REGSET_DSCR] = {
.core_note_type = NT_PPC_DSCR, .n = 1, .core_note_type = NT_PPC_DSCR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = dscr_get, .set = dscr_set .regset_get = dscr_get, .set = dscr_set
}, },
#endif #endif
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
[REGSET_TAR] = { [REGSET_TAR] = {
.core_note_type = NT_PPC_TAR, .n = 1, .core_note_type = NT_PPC_TAR, .n = 1,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.get = tar_get, .set = tar_set .regset_get = tar_get, .set = tar_set
}, },
[REGSET_EBB] = { [REGSET_EBB] = {
.core_note_type = NT_PPC_EBB, .n = ELF_NEBB, .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
.size = sizeof(u64), .align = sizeof(u64), .size = sizeof(u64), .align = sizeof(u64),
.active = ebb_active, .get = ebb_get, .set = ebb_set .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
}, },
#endif #endif
}; };
......
...@@ -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