aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2008-02-11 16:41:18 -0500
committerTony Luck <tony.luck@intel.com>2008-03-05 18:47:31 -0500
commit972559a05222c1d7ebd5dcde637542713bb8778d (patch)
tree71718577801cc213c870d6eabe8e7856b1df6b7e
parent29e8c3c304b62f31b799565c9ee85d42bd163f80 (diff)
[IA64] access user RBS directly
Because the user RBS of a process is now completely stored in user-mode when the process is ptrace-stopped, accesses to the RBS should no longer augment any part of the kernel RBS. This means we can get rid of most ia64_peek() and ia64_poke() calls. Signed-off-by: Petr Tesarik <ptesarik@suse.cz> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/kernel/ptrace.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 331d6768b5d5..9d2591423eb7 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -908,7 +908,7 @@ static int
908access_uarea (struct task_struct *child, unsigned long addr, 908access_uarea (struct task_struct *child, unsigned long addr,
909 unsigned long *data, int write_access) 909 unsigned long *data, int write_access)
910{ 910{
911 unsigned long *ptr, regnum, urbs_end, rnat_addr, cfm; 911 unsigned long *ptr, regnum, urbs_end, cfm;
912 struct switch_stack *sw; 912 struct switch_stack *sw;
913 struct pt_regs *pt; 913 struct pt_regs *pt;
914# define pt_reg_addr(pt, reg) ((void *) \ 914# define pt_reg_addr(pt, reg) ((void *) \
@@ -1093,16 +1093,8 @@ access_uarea (struct task_struct *child, unsigned long addr,
1093 return 0; 1093 return 0;
1094 1094
1095 case PT_AR_RNAT: 1095 case PT_AR_RNAT:
1096 urbs_end = ia64_get_user_rbs_end(child, pt, NULL); 1096 ptr = pt_reg_addr(pt, ar_rnat);
1097 rnat_addr = (long) ia64_rse_rnat_addr((long *) 1097 break;
1098 urbs_end);
1099 if (write_access)
1100 return ia64_poke(child, sw, urbs_end,
1101 rnat_addr, *data);
1102 else
1103 return ia64_peek(child, sw, urbs_end,
1104 rnat_addr, data);
1105
1106 case PT_R1: 1098 case PT_R1:
1107 ptr = pt_reg_addr(pt, r1); 1099 ptr = pt_reg_addr(pt, r1);
1108 break; 1100 break;
@@ -1541,11 +1533,10 @@ asmlinkage long
1541sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) 1533sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1542{ 1534{
1543 struct pt_regs *pt; 1535 struct pt_regs *pt;
1544 unsigned long urbs_end, peek_or_poke; 1536 unsigned long peek_or_poke;
1545 struct task_struct *child; 1537 struct task_struct *child;
1546 struct switch_stack *sw; 1538 struct switch_stack *sw;
1547 long ret; 1539 long ret;
1548 struct unw_frame_info info;
1549 1540
1550 lock_kernel(); 1541 lock_kernel();
1551 ret = -EPERM; 1542 ret = -EPERM;
@@ -1593,26 +1584,19 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1593 case PTRACE_PEEKTEXT: 1584 case PTRACE_PEEKTEXT:
1594 case PTRACE_PEEKDATA: 1585 case PTRACE_PEEKDATA:
1595 /* read word at location addr */ 1586 /* read word at location addr */
1596 urbs_end = ia64_get_user_rbs_end(child, pt, NULL); 1587 if (access_process_vm(child, addr, &data, sizeof(data), 0)
1597 ret = ia64_peek(child, sw, urbs_end, addr, &data); 1588 != sizeof(data)) {
1598 if (ret == 0) { 1589 ret = -EIO;
1599 ret = data; 1590 goto out_tsk;
1600 /* ensure "ret" is not mistaken as an error code: */
1601 force_successful_syscall_return();
1602 } 1591 }
1592 ret = data;
1593 /* ensure "ret" is not mistaken as an error code */
1594 force_successful_syscall_return();
1603 goto out_tsk; 1595 goto out_tsk;
1604 1596
1605 case PTRACE_POKETEXT: 1597 /* PTRACE_POKETEXT and PTRACE_POKEDATA is handled
1606 case PTRACE_POKEDATA: 1598 * by the generic ptrace_request().
1607 /* write the word at location addr */ 1599 */
1608 urbs_end = ia64_get_user_rbs_end(child, pt, NULL);
1609 ret = ia64_poke(child, sw, urbs_end, addr, data);
1610
1611 /* Make sure user RBS has the latest data */
1612 unw_init_from_blocked_task(&info, child);
1613 do_sync_rbs(&info, ia64_sync_user_rbs);
1614
1615 goto out_tsk;
1616 1600
1617 case PTRACE_PEEKUSR: 1601 case PTRACE_PEEKUSR:
1618 /* read the word at addr in the USER area */ 1602 /* read the word at addr in the USER area */