patch-2.4.25 linux-2.4.25/arch/ppc64/kernel/ptrace.c

Next file: linux-2.4.25/arch/ppc64/kernel/ptrace32.c
Previous file: linux-2.4.25/arch/ppc64/kernel/prom.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/arch/ppc64/kernel/ptrace.c linux-2.4.25/arch/ppc64/kernel/ptrace.c
@@ -67,6 +67,28 @@
 	return -EIO;
 }
 
+#ifdef CONFIG_ALTIVEC
+/*
+ * Get contents of AltiVec register state in task TASK
+ */
+static inline int get_vrregs(unsigned long data, struct task_struct *task)
+{
+	return (copy_to_user((void *)data,&task->thread.vr[0],
+			offsetof(struct thread_struct,vrsave[2])-
+			     offsetof(struct thread_struct,vr[0])) ? -EFAULT : 0 );
+}
+
+/*
+ * Write contents of AltiVec register state into task TASK.
+ */
+static inline int set_vrregs(struct task_struct *task, unsigned long data)
+{
+	return (copy_from_user(&task->thread.vr[0],(void *)data,
+			offsetof(struct thread_struct,vrsave[2])-
+			     offsetof(struct thread_struct,vr[0])) ? -EFAULT : 0 );
+}
+#endif
+
 static inline void
 set_single_step(struct task_struct *task)
 {
@@ -316,6 +338,23 @@
 		}
 		break;
 	}
+#ifdef CONFIG_ALTIVEC
+	case PTRACE_GETVRREGS:
+		/* Get the child altivec register state. */
+		if (child->thread.regs->msr & MSR_VEC)
+			giveup_altivec(child);
+		ret = get_vrregs(data, child);
+		break;
+
+	case PTRACE_SETVRREGS:
+		/* Set the child altivec register state. */
+		/* this is to clear the MSR_VEC bit to force a reload
+		 * of register state from memory */
+		if (child->thread.regs->msr & MSR_VEC)
+			giveup_altivec(child);
+		ret = set_vrregs(child,data);
+		break;
+#endif
 
 	default:
 		ret = -EIO;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)