[PATCH] Add PTRACE_{GET|SET}VRREGS
Robert C. Jennings
rcjenn at austin.ibm.com
Wed Aug 31 02:48:12 EST 2005
The ptrace get and set methods for VMX/Altivec registers present in the
ppc tree were missing for ppc64. This patch adds the 32-bit and 64-bit
methods.
Signed-off-by: Robert C Jennings <rcjenn at austin.ibm.com>
---
ptrace.c | 18 ++++++++++++++++++
ptrace32.c | 18 ++++++++++++++++++
2 files changed, 36 insertions(+)
diff -uprN -X linux-2.6.13/Documentation/dontdiff linux-2.6.13.orig/arch/ppc64/kernel/ptrace32.c linux-2.6.13/arch/ppc64/kernel/ptrace32.c
--- linux-2.6.13.orig/arch/ppc64/kernel/ptrace32.c 2005-08-28 18:41:01.000000000 -0500
+++ linux-2.6.13/arch/ppc64/kernel/ptrace32.c 2005-08-30 11:12:18.000000000 -0500
@@ -408,6 +408,24 @@ int sys32_ptrace(long request, long pid,
case PTRACE_GETEVENTMSG:
ret = put_user(child->ptrace_message, (unsigned int __user *) data);
break;
+
+#ifdef CONFIG_ALTIVEC
+ case PTRACE_GETVRREGS:
+ /* Get the child altivec register state. */
+ if (copy_to_user((void *)data, &child->thread.vr[0],
+ offsetof(struct thread_struct, used_vr) -
+ offsetof(struct thread_struct, vr[0])))
+ ret = -EFAULT;
+ break;
+
+ case PTRACE_SETVRREGS:
+ /* Set the child altivec register state. */
+ if (copy_from_user(&child->thread.vr[0], (void *)data,
+ offsetof(struct thread_struct, used_vr) -
+ offsetof(struct thread_struct, vr[0])))
+ ret = -EFAULT;
+ break;
+#endif
default:
ret = ptrace_request(child, request, addr, data);
diff -uprN -X linux-2.6.13/Documentation/dontdiff linux-2.6.13.orig/arch/ppc64/kernel/ptrace.c linux-2.6.13/arch/ppc64/kernel/ptrace.c
--- linux-2.6.13.orig/arch/ppc64/kernel/ptrace.c 2005-08-28 18:41:01.000000000 -0500
+++ linux-2.6.13/arch/ppc64/kernel/ptrace.c 2005-08-30 11:11:59.000000000 -0500
@@ -274,6 +274,24 @@ int sys_ptrace(long request, long pid, l
break;
}
+#ifdef CONFIG_ALTIVEC
+ case PTRACE_GETVRREGS:
+ /* Get the child altivec register state. */
+ if (copy_to_user((void *)data, &child->thread.vr[0],
+ offsetof(struct thread_struct, used_vr) -
+ offsetof(struct thread_struct, vr[0])))
+ ret = -EFAULT;
+ break;
+
+ case PTRACE_SETVRREGS:
+ /* Set the child altivec register state. */
+ if (copy_from_user(&child->thread.vr[0], (void *)data,
+ offsetof(struct thread_struct, used_vr) -
+ offsetof(struct thread_struct, vr[0])))
+ ret = -EFAULT;
+ break;
+#endif
+
default:
ret = ptrace_request(child, request, addr, data);
break;
More information about the Linuxppc64-dev
mailing list