*/
#define DCCR_MASK 0x0000001f /* XNZVC */
-extern inline long get_reg(struct task_struct *, unsigned int);
-extern inline long put_reg(struct task_struct *, unsigned int, unsigned long);
+/*
+ * Get contents of register REGNO in task TASK.
+ */
+inline long get_reg(struct task_struct *task, unsigned int regno)
+{
+ /* USP is a special case, it's not in the pt_regs struct but
+ * in the tasks thread struct
+ */
+
+ if (regno == PT_USP)
+ return task->thread.usp;
+ else if (regno < PT_MAX)
+ return ((unsigned long *)user_regs(task->thread_info))[regno];
+ else
+ return 0;
+}
+
+/*
+ * Write contents of register REGNO in task TASK.
+ */
+inline int put_reg(struct task_struct *task, unsigned int regno,
+ unsigned long data)
+{
+ if (regno == PT_USP)
+ task->thread.usp = data;
+ else if (regno < PT_MAX)
+ ((unsigned long *)user_regs(task->thread_info))[regno] = data;
+ else
+ return -1;
+ return 0;
+}
/*
* Called by kernel/ptrace.c when detaching.
{
struct task_struct *child;
int ret;
+ unsigned long __user *datap = (unsigned long __user *)data;
lock_kernel();
ret = -EPERM;
if (copied != sizeof(tmp))
break;
- ret = put_user(tmp,(unsigned long *) data);
+ ret = put_user(tmp,datap);
break;
}
break;
tmp = get_reg(child, addr >> 2);
- ret = put_user(tmp, (unsigned long *)data);
+ ret = put_user(tmp, datap);
break;
}
for (i = 0; i <= PT_MAX; i++) {
tmp = get_reg(child, i);
- if (put_user(tmp, (unsigned long *) data)) {
+ if (put_user(tmp, datap)) {
ret = -EFAULT;
goto out_tsk;
}
unsigned long tmp;
for (i = 0; i <= PT_MAX; i++) {
- if (get_user(tmp, (unsigned long *) data)) {
+ if (get_user(tmp, datap)) {
ret = -EFAULT;
goto out_tsk;
}