Commit aa17f6f9 authored by Petr Tesarik's avatar Petr Tesarik Committed by Tony Luck

[IA64] arch_ptrace() cleanup

Remove duplicate code, clean up goto's and indentation.
Signed-off-by: default avatarPetr Tesarik <ptesarik@suse.cz>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 8db3f525
...@@ -1491,88 +1491,60 @@ user_disable_single_step (struct task_struct *child) ...@@ -1491,88 +1491,60 @@ user_disable_single_step (struct task_struct *child)
void void
ptrace_disable (struct task_struct *child) ptrace_disable (struct task_struct *child)
{ {
struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); user_disable_single_step(child);
/* make sure the single step/taken-branch trap bits are not set: */
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
child_psr->ss = 0;
child_psr->tb = 0;
} }
long long
arch_ptrace (struct task_struct *child, long request, long addr, long data) arch_ptrace (struct task_struct *child, long request, long addr, long data)
{ {
struct pt_regs *pt;
struct switch_stack *sw;
long ret;
pt = task_pt_regs(child);
sw = (struct switch_stack *) (child->thread.ksp + 16);
switch (request) { switch (request) {
case PTRACE_PEEKTEXT: case PTRACE_PEEKTEXT:
case PTRACE_PEEKDATA: case PTRACE_PEEKDATA:
/* read word at location addr */ /* read word at location addr */
if (access_process_vm(child, addr, &data, sizeof(data), 0) if (access_process_vm(child, addr, &data, sizeof(data), 0)
!= sizeof(data)) { != sizeof(data))
ret = -EIO; return -EIO;
goto out_tsk; /* ensure return value is not mistaken for error code */
}
ret = data;
/* ensure "ret" is not mistaken as an error code */
force_successful_syscall_return(); force_successful_syscall_return();
goto out_tsk; return data;
/* PTRACE_POKETEXT and PTRACE_POKEDATA is handled /* PTRACE_POKETEXT and PTRACE_POKEDATA is handled
* by the generic ptrace_request(). * by the generic ptrace_request().
*/ */
case PTRACE_PEEKUSR: case PTRACE_PEEKUSR:
/* read the word at addr in the USER area */ /* read the word at addr in the USER area */
if (access_uarea(child, addr, &data, 0) < 0) { if (access_uarea(child, addr, &data, 0) < 0)
ret = -EIO; return -EIO;
goto out_tsk; /* ensure return value is not mistaken for error code */
}
ret = data;
/* ensure "ret" is not mistaken as an error code */
force_successful_syscall_return(); force_successful_syscall_return();
goto out_tsk; return data;
case PTRACE_POKEUSR: case PTRACE_POKEUSR:
/* write the word at addr in the USER area */ /* write the word at addr in the USER area */
if (access_uarea(child, addr, &data, 1) < 0) { if (access_uarea(child, addr, &data, 1) < 0)
ret = -EIO; return -EIO;
goto out_tsk; return 0;
}
ret = 0;
goto out_tsk;
case PTRACE_OLD_GETSIGINFO: case PTRACE_OLD_GETSIGINFO:
/* for backwards-compatibility */ /* for backwards-compatibility */
ret = ptrace_request(child, PTRACE_GETSIGINFO, addr, data); return ptrace_request(child, PTRACE_GETSIGINFO, addr, data);
goto out_tsk;
case PTRACE_OLD_SETSIGINFO: case PTRACE_OLD_SETSIGINFO:
/* for backwards-compatibility */ /* for backwards-compatibility */
ret = ptrace_request(child, PTRACE_SETSIGINFO, addr, data); return ptrace_request(child, PTRACE_SETSIGINFO, addr, data);
goto out_tsk;
case PTRACE_GETREGS:
case PTRACE_GETREGS: return ptrace_getregs(child,
ret = ptrace_getregs(child, (struct pt_all_user_regs __user *) data);
(struct pt_all_user_regs __user *) data);
goto out_tsk; case PTRACE_SETREGS:
return ptrace_setregs(child,
case PTRACE_SETREGS: (struct pt_all_user_regs __user *) data);
ret = ptrace_setregs(child,
(struct pt_all_user_regs __user *) data); default:
goto out_tsk; return ptrace_request(child, request, addr, data);
default:
ret = ptrace_request(child, request, addr, data);
goto out_tsk;
} }
out_tsk:
return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment