aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/ia32/sys_ia32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/ia32/sys_ia32.c')
-rw-r--r--arch/ia64/ia32/sys_ia32.c83
1 files changed, 6 insertions, 77 deletions
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 800a7174a5cb..5e92ae00bdbb 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1194,25 +1194,6 @@ sys32_waitpid (int pid, unsigned int *stat_addr, int options)
1194 return compat_sys_wait4(pid, stat_addr, options, NULL); 1194 return compat_sys_wait4(pid, stat_addr, options, NULL);
1195} 1195}
1196 1196
1197static unsigned int
1198ia32_peek (struct task_struct *child, unsigned long addr, unsigned int *val)
1199{
1200 size_t copied;
1201 unsigned int ret;
1202
1203 copied = access_process_vm(child, addr, val, sizeof(*val), 0);
1204 return (copied != sizeof(ret)) ? -EIO : 0;
1205}
1206
1207static unsigned int
1208ia32_poke (struct task_struct *child, unsigned long addr, unsigned int val)
1209{
1210
1211 if (access_process_vm(child, addr, &val, sizeof(val), 1) != sizeof(val))
1212 return -EIO;
1213 return 0;
1214}
1215
1216/* 1197/*
1217 * The order in which registers are stored in the ptrace regs structure 1198 * The order in which registers are stored in the ptrace regs structure
1218 */ 1199 */
@@ -1510,49 +1491,15 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
1510 return 0; 1491 return 0;
1511} 1492}
1512 1493
1513asmlinkage long 1494long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
1514sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data) 1495 compat_ulong_t caddr, compat_ulong_t cdata)
1515{ 1496{
1516 struct task_struct *child; 1497 unsigned long addr = caddr;
1517 unsigned int value, tmp; 1498 unsigned long data = cdata;
1499 unsigned int tmp;
1518 long i, ret; 1500 long i, ret;
1519 1501
1520 lock_kernel();
1521 if (request == PTRACE_TRACEME) {
1522 ret = ptrace_traceme();
1523 goto out;
1524 }
1525
1526 child = ptrace_get_task_struct(pid);
1527 if (IS_ERR(child)) {
1528 ret = PTR_ERR(child);
1529 goto out;
1530 }
1531
1532 if (request == PTRACE_ATTACH) {
1533 ret = sys_ptrace(request, pid, addr, data);
1534 goto out_tsk;
1535 }
1536
1537 ret = ptrace_check_attach(child, request == PTRACE_KILL);
1538 if (ret < 0)
1539 goto out_tsk;
1540
1541 switch (request) { 1502 switch (request) {
1542 case PTRACE_PEEKTEXT:
1543 case PTRACE_PEEKDATA: /* read word at location addr */
1544 ret = ia32_peek(child, addr, &value);
1545 if (ret == 0)
1546 ret = put_user(value, (unsigned int __user *) compat_ptr(data));
1547 else
1548 ret = -EIO;
1549 goto out_tsk;
1550
1551 case PTRACE_POKETEXT:
1552 case PTRACE_POKEDATA: /* write the word at location addr */
1553 ret = ia32_poke(child, addr, data);
1554 goto out_tsk;
1555
1556 case PTRACE_PEEKUSR: /* read word at addr in USER area */ 1503 case PTRACE_PEEKUSR: /* read word at addr in USER area */
1557 ret = -EIO; 1504 ret = -EIO;
1558 if ((addr & 3) || addr > 17*sizeof(int)) 1505 if ((addr & 3) || addr > 17*sizeof(int))
@@ -1617,27 +1564,9 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data)
1617 compat_ptr(data)); 1564 compat_ptr(data));
1618 break; 1565 break;
1619 1566
1620 case PTRACE_GETEVENTMSG:
1621 ret = put_user(child->ptrace_message, (unsigned int __user *) compat_ptr(data));
1622 break;
1623
1624 case PTRACE_SYSCALL: /* continue, stop after next syscall */
1625 case PTRACE_CONT: /* restart after signal. */
1626 case PTRACE_KILL:
1627 case PTRACE_SINGLESTEP: /* execute chile for one instruction */
1628 case PTRACE_DETACH: /* detach a process */
1629 ret = sys_ptrace(request, pid, addr, data);
1630 break;
1631
1632 default: 1567 default:
1633 ret = ptrace_request(child, request, addr, data); 1568 return compat_ptrace_request(child, request, caddr, cdata);
1634 break;
1635
1636 } 1569 }
1637 out_tsk:
1638 put_task_struct(child);
1639 out:
1640 unlock_kernel();
1641 return ret; 1570 return ret;
1642} 1571}
1643 1572