aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/ptrace.c
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2008-02-26 06:03:28 -0500
committerTony Luck <tony.luck@intel.com>2008-03-05 18:50:48 -0500
commitaa17f6f930b19df2901aa78c88530653cdcfc450 (patch)
tree3e67322f9c329197472e24d1884e6501a1ff6bf3 /arch/ia64/kernel/ptrace.c
parent8db3f5254151c3a06a764bbb18283570ba1897bf (diff)
[IA64] arch_ptrace() cleanup
Remove duplicate code, clean up goto's and indentation. Signed-off-by: Petr Tesarik <ptesarik@suse.cz> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/ptrace.c')
-rw-r--r--arch/ia64/kernel/ptrace.c90
1 files changed, 31 insertions, 59 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index f10c8b40dd3f..7e0d7dcac1a9 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1491,88 +1491,60 @@ user_disable_single_step (struct task_struct *child)
1491void 1491void
1492ptrace_disable (struct task_struct *child) 1492ptrace_disable (struct task_struct *child)
1493{ 1493{
1494 struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); 1494 user_disable_single_step(child);
1495
1496 /* make sure the single step/taken-branch trap bits are not set: */
1497 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
1498 child_psr->ss = 0;
1499 child_psr->tb = 0;
1500} 1495}
1501 1496
1502long 1497long
1503arch_ptrace (struct task_struct *child, long request, long addr, long data) 1498arch_ptrace (struct task_struct *child, long request, long addr, long data)
1504{ 1499{
1505 struct pt_regs *pt;
1506 struct switch_stack *sw;
1507 long ret;
1508
1509 pt = task_pt_regs(child);
1510 sw = (struct switch_stack *) (child->thread.ksp + 16);
1511
1512 switch (request) { 1500 switch (request) {
1513 case PTRACE_PEEKTEXT: 1501 case PTRACE_PEEKTEXT:
1514 case PTRACE_PEEKDATA: 1502 case PTRACE_PEEKDATA:
1515 /* read word at location addr */ 1503 /* read word at location addr */
1516 if (access_process_vm(child, addr, &data, sizeof(data), 0) 1504 if (access_process_vm(child, addr, &data, sizeof(data), 0)
1517 != sizeof(data)) { 1505 != sizeof(data))
1518 ret = -EIO; 1506 return -EIO;
1519 goto out_tsk; 1507 /* ensure return value is not mistaken for error code */
1520 }
1521 ret = data;
1522 /* ensure "ret" is not mistaken as an error code */
1523 force_successful_syscall_return(); 1508 force_successful_syscall_return();
1524 goto out_tsk; 1509 return data;
1525 1510
1526 /* PTRACE_POKETEXT and PTRACE_POKEDATA is handled 1511 /* PTRACE_POKETEXT and PTRACE_POKEDATA is handled
1527 * by the generic ptrace_request(). 1512 * by the generic ptrace_request().
1528 */ 1513 */
1529 1514
1530 case PTRACE_PEEKUSR: 1515 case PTRACE_PEEKUSR:
1531 /* read the word at addr in the USER area */ 1516 /* read the word at addr in the USER area */
1532 if (access_uarea(child, addr, &data, 0) < 0) { 1517 if (access_uarea(child, addr, &data, 0) < 0)
1533 ret = -EIO; 1518 return -EIO;
1534 goto out_tsk; 1519 /* ensure return value is not mistaken for error code */
1535 }
1536 ret = data;
1537 /* ensure "ret" is not mistaken as an error code */
1538 force_successful_syscall_return(); 1520 force_successful_syscall_return();
1539 goto out_tsk; 1521 return data;
1540 1522
1541 case PTRACE_POKEUSR: 1523 case PTRACE_POKEUSR:
1542 /* write the word at addr in the USER area */ 1524 /* write the word at addr in the USER area */
1543 if (access_uarea(child, addr, &data, 1) < 0) { 1525 if (access_uarea(child, addr, &data, 1) < 0)
1544 ret = -EIO; 1526 return -EIO;
1545 goto out_tsk; 1527 return 0;
1546 }
1547 ret = 0;
1548 goto out_tsk;
1549 1528
1550 case PTRACE_OLD_GETSIGINFO: 1529 case PTRACE_OLD_GETSIGINFO:
1551 /* for backwards-compatibility */ 1530 /* for backwards-compatibility */
1552 ret = ptrace_request(child, PTRACE_GETSIGINFO, addr, data); 1531 return ptrace_request(child, PTRACE_GETSIGINFO, addr, data);
1553 goto out_tsk;
1554 1532
1555 case PTRACE_OLD_SETSIGINFO: 1533 case PTRACE_OLD_SETSIGINFO:
1556 /* for backwards-compatibility */ 1534 /* for backwards-compatibility */
1557 ret = ptrace_request(child, PTRACE_SETSIGINFO, addr, data); 1535 return ptrace_request(child, PTRACE_SETSIGINFO, addr, data);
1558 goto out_tsk; 1536
1559 1537 case PTRACE_GETREGS:
1560 case PTRACE_GETREGS: 1538 return ptrace_getregs(child,
1561 ret = ptrace_getregs(child, 1539 (struct pt_all_user_regs __user *) data);
1562 (struct pt_all_user_regs __user *) data); 1540
1563 goto out_tsk; 1541 case PTRACE_SETREGS:
1564 1542 return ptrace_setregs(child,
1565 case PTRACE_SETREGS: 1543 (struct pt_all_user_regs __user *) data);
1566 ret = ptrace_setregs(child, 1544
1567 (struct pt_all_user_regs __user *) data); 1545 default:
1568 goto out_tsk; 1546 return ptrace_request(child, request, addr, data);
1569
1570 default:
1571 ret = ptrace_request(child, request, addr, data);
1572 goto out_tsk;
1573 } 1547 }
1574 out_tsk:
1575 return ret;
1576} 1548}
1577 1549
1578 1550