Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83991
b: refs/heads/master
c: f65255e
h: refs/heads/master
i:
  83989: bf0bc89
  83987: 2e4d58f
  83983: eda8ddf
v: v3
  • Loading branch information
Roland McGrath authored and Paul Mackerras committed Feb 7, 2008
1 parent 64210a7 commit 604016f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ab3e84f66321579ca36b63a13bf78decba65121
refs/heads/master: f65255e8d51ecbc6c9eef20d39e0377d19b658ca
37 changes: 31 additions & 6 deletions trunk/arch/powerpc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/smp.h>
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/regset.h>
#include <linux/user.h>
#include <linux/security.h>
#include <linux/signal.h>
Expand Down Expand Up @@ -103,24 +104,48 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)
}


static int fpr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf)
{
flush_fp_to_thread(target);

BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) !=
offsetof(struct thread_struct, fpr[32]));

return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&target->thread.fpr, 0, -1);
}

static int fpr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf)
{
flush_fp_to_thread(target);

BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) !=
offsetof(struct thread_struct, fpr[32]));

return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&target->thread.fpr, 0, -1);
}

static int get_fpregs(void __user *data, struct task_struct *task,
int has_fpscr)
{
unsigned int count = has_fpscr ? 33 : 32;

if (copy_to_user(data, task->thread.fpr, count * sizeof(double)))
if (!access_ok(VERIFY_WRITE, data, count * sizeof(double)))
return -EFAULT;
return 0;
return fpr_get(task, NULL, 0, count * sizeof(double), NULL, data);
}

static int set_fpregs(void __user *data, struct task_struct *task,
int has_fpscr)
{
unsigned int count = has_fpscr ? 33 : 32;

if (copy_from_user(task->thread.fpr, data, count * sizeof(double)))
if (!access_ok(VERIFY_READ, data, count * sizeof(double)))
return -EFAULT;
return 0;
return fpr_set(task, NULL, 0, count * sizeof(double), NULL, data);
}


Expand Down

0 comments on commit 604016f

Please sign in to comment.