aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/ia32
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2008-09-18 03:50:26 -0400
committerTony Luck <tony.luck@intel.com>2008-10-06 13:45:29 -0400
commit680973edf122fd95735ecfc077cf79645d2e5081 (patch)
tree8023bf84c6e856f616215082d05bb91ec8e1b620 /arch/ia64/ia32
parent9690ad031290d86979b284bd6243313f58271bcc (diff)
[IA64] utrace Convert compat ptrace to use compat_sys_ptrace
Convert IA64 32-bit ptrace to use compat_sys_ptrace. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/ia32')
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/sys_ia32.c83
2 files changed, 7 insertions, 78 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index b905dcb791ff..a73ec0089d43 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -204,7 +204,7 @@ ia32_syscall_table:
204 data8 sys_setuid /* 16-bit version */ 204 data8 sys_setuid /* 16-bit version */
205 data8 sys_getuid /* 16-bit version */ 205 data8 sys_getuid /* 16-bit version */
206 data8 compat_sys_stime /* 25 */ 206 data8 compat_sys_stime /* 25 */
207 data8 sys32_ptrace 207 data8 compat_sys_ptrace
208 data8 sys32_alarm 208 data8 sys32_alarm
209 data8 sys_ni_syscall 209 data8 sys_ni_syscall
210 data8 sys32_pause 210 data8 sys32_pause
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index bf196cbb3796..5df5e4c90e4d 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1300,25 +1300,6 @@ sys32_waitpid (int pid, unsigned int *stat_addr, int options)
1300 return compat_sys_wait4(pid, stat_addr, options, NULL); 1300 return compat_sys_wait4(pid, stat_addr, options, NULL);
1301} 1301}
1302 1302
1303static unsigned int
1304ia32_peek (struct task_struct *child, unsigned long addr, unsigned int *val)
1305{
1306 size_t copied;
1307 unsigned int ret;
1308
1309 copied = access_process_vm(child, addr, val, sizeof(*val), 0);
1310 return (copied != sizeof(ret)) ? -EIO : 0;
1311}
1312
1313static unsigned int
1314ia32_poke (struct task_struct *child, unsigned long addr, unsigned int val)
1315{
1316
1317 if (access_process_vm(child, addr, &val, sizeof(val), 1) != sizeof(val))
1318 return -EIO;
1319 return 0;
1320}
1321
1322/* 1303/*
1323 * The order in which registers are stored in the ptrace regs structure 1304 * The order in which registers are stored in the ptrace regs structure
1324 */ 1305 */
@@ -1616,49 +1597,15 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
1616 return 0; 1597 return 0;
1617} 1598}
1618 1599
1619asmlinkage long 1600long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
1620sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data) 1601 compat_ulong_t caddr, compat_ulong_t cdata)
1621{ 1602{
1622 struct task_struct *child; 1603 unsigned long addr = caddr;
1623 unsigned int value, tmp; 1604 unsigned long data = cdata;
1605 unsigned int tmp;
1624 long i, ret; 1606 long i, ret;
1625 1607
1626 lock_kernel();
1627 if (request == PTRACE_TRACEME) {
1628 ret = ptrace_traceme();
1629 goto out;
1630 }
1631
1632 child = ptrace_get_task_struct(pid);
1633 if (IS_ERR(child)) {
1634 ret = PTR_ERR(child);
1635 goto out;
1636 }
1637
1638 if (request == PTRACE_ATTACH) {
1639 ret = sys_ptrace(request, pid, addr, data);
1640 goto out_tsk;
1641 }
1642
1643 ret = ptrace_check_attach(child, request == PTRACE_KILL);
1644 if (ret < 0)
1645 goto out_tsk;
1646
1647 switch (request) { 1608 switch (request) {
1648 case PTRACE_PEEKTEXT:
1649 case PTRACE_PEEKDATA: /* read word at location addr */
1650 ret = ia32_peek(child, addr, &value);
1651 if (ret == 0)
1652 ret = put_user(value, (unsigned int __user *) compat_ptr(data));
1653 else
1654 ret = -EIO;
1655 goto out_tsk;
1656
1657 case PTRACE_POKETEXT:
1658 case PTRACE_POKEDATA: /* write the word at location addr */
1659 ret = ia32_poke(child, addr, data);
1660 goto out_tsk;
1661
1662 case PTRACE_PEEKUSR: /* read word at addr in USER area */ 1609 case PTRACE_PEEKUSR: /* read word at addr in USER area */
1663 ret = -EIO; 1610 ret = -EIO;
1664 if ((addr & 3) || addr > 17*sizeof(int)) 1611 if ((addr & 3) || addr > 17*sizeof(int))
@@ -1723,27 +1670,9 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data)
1723 compat_ptr(data)); 1670 compat_ptr(data));
1724 break; 1671 break;
1725 1672
1726 case PTRACE_GETEVENTMSG:
1727 ret = put_user(child->ptrace_message, (unsigned int __user *) compat_ptr(data));
1728 break;
1729
1730 case PTRACE_SYSCALL: /* continue, stop after next syscall */
1731 case PTRACE_CONT: /* restart after signal. */
1732 case PTRACE_KILL:
1733 case PTRACE_SINGLESTEP: /* execute chile for one instruction */
1734 case PTRACE_DETACH: /* detach a process */
1735 ret = sys_ptrace(request, pid, addr, data);
1736 break;
1737
1738 default: 1673 default:
1739 ret = ptrace_request(child, request, addr, data); 1674 return compat_ptrace_request(child, request, caddr, cdata);
1740 break;
1741
1742 } 1675 }
1743 out_tsk:
1744 put_task_struct(child);
1745 out:
1746 unlock_kernel();
1747 return ret; 1676 return ret;
1748} 1677}
1749 1678