aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/ia32
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2008-10-17 16:51:16 -0400
committerTony Luck <tony.luck@intel.com>2008-10-17 16:51:16 -0400
commit9224652cc76417bfe779bcdb1243cf0b083e3eee (patch)
treed80d0f2d00d9eda6500deedc9488071f005f732b /arch/ia64/ia32
parent4d4230c27f380745b7fc30c0906402eede3b2cff (diff)
parent680973edf122fd95735ecfc077cf79645d2e5081 (diff)
Pull utrace into release branch
Diffstat (limited to 'arch/ia64/ia32')
-rw-r--r--arch/ia64/ia32/ia32_entry.S7
-rw-r--r--arch/ia64/ia32/sys_ia32.c83
2 files changed, 12 insertions, 78 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 82a7a0bc5d2e..a8cf19958850 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -108,6 +108,11 @@ GLOBAL_ENTRY(ia32_trace_syscall)
108 ;; 108 ;;
109 st8 [r2]=r3 // initialize return code to -ENOSYS 109 st8 [r2]=r3 // initialize return code to -ENOSYS
110 br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args 110 br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args
111 cmp.lt p6,p0=r8,r0 // check tracehook
112 adds r2=IA64_PT_REGS_R8_OFFSET+16,sp // r2 = &pt_regs.r8
113 ;;
114(p6) st8.spill [r2]=r8 // store return value in slot for r8
115(p6) br.spnt.few .ret4
111.ret2: // Need to reload arguments (they may be changed by the tracing process) 116.ret2: // Need to reload arguments (they may be changed by the tracing process)
112 adds r2=IA64_PT_REGS_R1_OFFSET+16,sp // r2 = &pt_regs.r1 117 adds r2=IA64_PT_REGS_R1_OFFSET+16,sp // r2 = &pt_regs.r1
113 adds r3=IA64_PT_REGS_R13_OFFSET+16,sp // r3 = &pt_regs.r13 118 adds r3=IA64_PT_REGS_R13_OFFSET+16,sp // r3 = &pt_regs.r13
@@ -199,7 +204,7 @@ ia32_syscall_table:
199 data8 sys_setuid /* 16-bit version */ 204 data8 sys_setuid /* 16-bit version */
200 data8 sys_getuid /* 16-bit version */ 205 data8 sys_getuid /* 16-bit version */
201 data8 compat_sys_stime /* 25 */ 206 data8 compat_sys_stime /* 25 */
202 data8 sys32_ptrace 207 data8 compat_sys_ptrace
203 data8 sys32_alarm 208 data8 sys32_alarm
204 data8 sys_ni_syscall 209 data8 sys_ni_syscall
205 data8 sys_pause 210 data8 sys_pause
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