Loading arch/sparc/kernel/ptrace_32.c +75 −38 Original line number Diff line number Diff line Loading @@ -137,7 +137,6 @@ static int genregs32_set(struct task_struct *target, if (ret || !count) return ret; if (pos < 32 * sizeof(u32)) { if (regwindow32_get(target, regs, uregs)) return -EFAULT; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, Loading @@ -149,7 +148,7 @@ static int genregs32_set(struct task_struct *target, return -EFAULT; if (!count) return 0; } ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &psr, 32 * sizeof(u32), 33 * sizeof(u32)); Loading Loading @@ -241,13 +240,11 @@ static int fpregs32_set(struct task_struct *target, user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 32 * sizeof(u32), 33 * sizeof(u32)); if (!ret && count > 0) { if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.fsr, 33 * sizeof(u32), 34 * sizeof(u32)); } if (!ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 34 * sizeof(u32), -1); Loading Loading @@ -313,6 +310,33 @@ static int getregs_get(struct task_struct *target, 4 * sizeof(u32), 19 * sizeof(u32)); } static int setregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct pt_regs *regs = target->thread.kregs; u32 v[4]; int ret; if (target == current) flush_user_windows(); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, v, 0, 4 * sizeof(u32)); if (ret) return ret; regs->psr = (regs->psr & ~(PSR_ICC | PSR_SYSCALL)) | (v[0] & (PSR_ICC | PSR_SYSCALL)); regs->pc = v[1]; regs->npc = v[2]; regs->y = v[3]; return user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs->u_regs + 1, 4 * sizeof(u32) , 19 * sizeof(u32)); } static int getfpregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, Loading Loading @@ -340,12 +364,37 @@ static int getfpregs_get(struct task_struct *target, 33 * sizeof(u32), 68 * sizeof(u32)); } static int setfpregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { unsigned long *fpregs = target->thread.float_regs; int ret; #if 0 if (target == current) save_and_clear_fpu(); #endif ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, fpregs, 0, 32 * sizeof(u32)); if (ret) return ret; return user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.fsr, 32 * sizeof(u32), 33 * sizeof(u32)); } static const struct user_regset ptrace32_regsets[] = { [REGSET_GENERAL] = { .n = 19, .size = sizeof(u32), .get = getregs_get, .n = 19, .size = sizeof(u32), .get = getregs_get, .set = setregs_set, }, [REGSET_FP] = { .n = 68, .size = sizeof(u32), .get = getfpregs_get, .n = 68, .size = sizeof(u32), .get = getfpregs_get, .set = setfpregs_set, }, }; Loading Loading @@ -380,12 +429,10 @@ long arch_ptrace(struct task_struct *child, long request, { unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4]; void __user *addr2p; const struct user_regset_view *view; struct pt_regs __user *pregs; struct fps __user *fps; int ret; view = task_user_regset_view(current); addr2p = (void __user *) addr2; pregs = (struct pt_regs __user *) addr; fps = (struct fps __user *) addr; Loading @@ -400,15 +447,10 @@ long arch_ptrace(struct task_struct *child, long request, } case PTRACE_SETREGS: { ret = copy_regset_from_user(child, view, REGSET_GENERAL, 32 * sizeof(u32), 4 * sizeof(u32), &pregs->psr); if (!ret) copy_regset_from_user(child, view, REGSET_GENERAL, 1 * sizeof(u32), 15 * sizeof(u32), &pregs->u_regs[0]); ret = copy_regset_from_user(child, &ptrace32_view, REGSET_GENERAL, 0, 19 * sizeof(u32), pregs); break; } Loading @@ -421,15 +463,10 @@ long arch_ptrace(struct task_struct *child, long request, } case PTRACE_SETFPREGS: { ret = copy_regset_from_user(child, view, REGSET_FP, 0 * sizeof(u32), 32 * sizeof(u32), &fps->regs[0]); if (!ret) ret = copy_regset_from_user(child, view, REGSET_FP, ret = copy_regset_from_user(child, &ptrace32_view, REGSET_FP, 0, 33 * sizeof(u32), 1 * sizeof(u32), &fps->fsr); fps); break; } Loading Loading
arch/sparc/kernel/ptrace_32.c +75 −38 Original line number Diff line number Diff line Loading @@ -137,7 +137,6 @@ static int genregs32_set(struct task_struct *target, if (ret || !count) return ret; if (pos < 32 * sizeof(u32)) { if (regwindow32_get(target, regs, uregs)) return -EFAULT; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, Loading @@ -149,7 +148,7 @@ static int genregs32_set(struct task_struct *target, return -EFAULT; if (!count) return 0; } ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &psr, 32 * sizeof(u32), 33 * sizeof(u32)); Loading Loading @@ -241,13 +240,11 @@ static int fpregs32_set(struct task_struct *target, user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 32 * sizeof(u32), 33 * sizeof(u32)); if (!ret && count > 0) { if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.fsr, 33 * sizeof(u32), 34 * sizeof(u32)); } if (!ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 34 * sizeof(u32), -1); Loading Loading @@ -313,6 +310,33 @@ static int getregs_get(struct task_struct *target, 4 * sizeof(u32), 19 * sizeof(u32)); } static int setregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct pt_regs *regs = target->thread.kregs; u32 v[4]; int ret; if (target == current) flush_user_windows(); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, v, 0, 4 * sizeof(u32)); if (ret) return ret; regs->psr = (regs->psr & ~(PSR_ICC | PSR_SYSCALL)) | (v[0] & (PSR_ICC | PSR_SYSCALL)); regs->pc = v[1]; regs->npc = v[2]; regs->y = v[3]; return user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs->u_regs + 1, 4 * sizeof(u32) , 19 * sizeof(u32)); } static int getfpregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, Loading Loading @@ -340,12 +364,37 @@ static int getfpregs_get(struct task_struct *target, 33 * sizeof(u32), 68 * sizeof(u32)); } static int setfpregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { unsigned long *fpregs = target->thread.float_regs; int ret; #if 0 if (target == current) save_and_clear_fpu(); #endif ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, fpregs, 0, 32 * sizeof(u32)); if (ret) return ret; return user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.fsr, 32 * sizeof(u32), 33 * sizeof(u32)); } static const struct user_regset ptrace32_regsets[] = { [REGSET_GENERAL] = { .n = 19, .size = sizeof(u32), .get = getregs_get, .n = 19, .size = sizeof(u32), .get = getregs_get, .set = setregs_set, }, [REGSET_FP] = { .n = 68, .size = sizeof(u32), .get = getfpregs_get, .n = 68, .size = sizeof(u32), .get = getfpregs_get, .set = setfpregs_set, }, }; Loading Loading @@ -380,12 +429,10 @@ long arch_ptrace(struct task_struct *child, long request, { unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4]; void __user *addr2p; const struct user_regset_view *view; struct pt_regs __user *pregs; struct fps __user *fps; int ret; view = task_user_regset_view(current); addr2p = (void __user *) addr2; pregs = (struct pt_regs __user *) addr; fps = (struct fps __user *) addr; Loading @@ -400,15 +447,10 @@ long arch_ptrace(struct task_struct *child, long request, } case PTRACE_SETREGS: { ret = copy_regset_from_user(child, view, REGSET_GENERAL, 32 * sizeof(u32), 4 * sizeof(u32), &pregs->psr); if (!ret) copy_regset_from_user(child, view, REGSET_GENERAL, 1 * sizeof(u32), 15 * sizeof(u32), &pregs->u_regs[0]); ret = copy_regset_from_user(child, &ptrace32_view, REGSET_GENERAL, 0, 19 * sizeof(u32), pregs); break; } Loading @@ -421,15 +463,10 @@ long arch_ptrace(struct task_struct *child, long request, } case PTRACE_SETFPREGS: { ret = copy_regset_from_user(child, view, REGSET_FP, 0 * sizeof(u32), 32 * sizeof(u32), &fps->regs[0]); if (!ret) ret = copy_regset_from_user(child, view, REGSET_FP, ret = copy_regset_from_user(child, &ptrace32_view, REGSET_FP, 0, 33 * sizeof(u32), 1 * sizeof(u32), &fps->fsr); fps); break; } Loading