提交 b0f3bdc0 编写于 作者: Q Qi Hu 提交者: Huacai Chen

LoongArch: Fix missing fcsr in ptrace's fpr_set

In file ptrace.c, function fpr_set does not copy fcsr data from ubuf
to kbuf. That's the reason why fcsr cannot be modified by ptrace.

This patch fixs this problem and allows users using ptrace to modify
the fcsr.
Co-developed-by: NXu Li <lixu@loongson.cn>
Signed-off-by: NQi Hu <huqi@loongson.cn>
Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
上级 1aea29d7
...@@ -193,7 +193,7 @@ static int fpr_set(struct task_struct *target, ...@@ -193,7 +193,7 @@ static int fpr_set(struct task_struct *target,
const void *kbuf, const void __user *ubuf) const void *kbuf, const void __user *ubuf)
{ {
const int fcc_start = NUM_FPU_REGS * sizeof(elf_fpreg_t); const int fcc_start = NUM_FPU_REGS * sizeof(elf_fpreg_t);
const int fcc_end = fcc_start + sizeof(u64); const int fcsr_start = fcc_start + sizeof(u64);
int err; int err;
BUG_ON(count % sizeof(elf_fpreg_t)); BUG_ON(count % sizeof(elf_fpreg_t));
...@@ -209,10 +209,12 @@ static int fpr_set(struct task_struct *target, ...@@ -209,10 +209,12 @@ static int fpr_set(struct task_struct *target,
if (err) if (err)
return err; return err;
if (count > 0) err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf,
err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.fpu.fcc, fcc_start,
&target->thread.fpu.fcc, fcc_start + sizeof(u64));
fcc_start, fcc_end); err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&target->thread.fpu.fcsr, fcsr_start,
fcsr_start + sizeof(u32));
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册