enable kexec
[linux-2.6.git] / arch / ppc64 / kernel / ptrace.c
index efc9dbd..9c3d2f5 100644 (file)
@@ -76,6 +76,8 @@ int sys_ptrace(long request, long pid, long addr, long data)
        read_unlock(&tasklist_lock);
        if (!child)
                goto out;
+       if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
+               goto out_tsk;
 
        ret = -EPERM;
        if (pid == 1)           /* you may not mess with init */
@@ -119,8 +121,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                if (index < PT_FPR0) {
                        tmp = get_reg(child, (int)index);
                } else {
-                       if (child->thread.regs->msr & MSR_FP)
-                               giveup_fpu(child);
+                       flush_fp_to_thread(child);
                        tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
                }
                ret = put_user(tmp,(unsigned long __user *) data);
@@ -152,8 +153,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                if (index < PT_FPR0) {
                        ret = put_reg(child, index, data);
                } else {
-                       if (child->thread.regs->msr & MSR_FP)
-                               giveup_fpu(child);
+                       flush_fp_to_thread(child);
                        ((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data;
                        ret = 0;
                }
@@ -245,8 +245,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
                unsigned long __user *tmp = (unsigned long __user *)addr;
 
-               if (child->thread.regs->msr & MSR_FP)
-                       giveup_fpu(child);
+               flush_fp_to_thread(child);
 
                for (i = 0; i < 32; i++) {
                        ret = put_user(*reg, tmp);
@@ -263,8 +262,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
                unsigned long __user *tmp = (unsigned long __user *)addr;
 
-               if (child->thread.regs->msr & MSR_FP)
-                       giveup_fpu(child);
+               flush_fp_to_thread(child);
 
                for (i = 0; i < 32; i++) {
                        ret = get_user(*reg, tmp);