aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/h8300/kernel/ptrace.c')
-rw-r--r--arch/h8300/kernel/ptrace.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
index df114122ebdf..497fa89b5df4 100644
--- a/arch/h8300/kernel/ptrace.c
+++ b/arch/h8300/kernel/ptrace.c
@@ -50,27 +50,29 @@ void ptrace_disable(struct task_struct *child)
50 user_disable_single_step(child); 50 user_disable_single_step(child);
51} 51}
52 52
53long arch_ptrace(struct task_struct *child, long request, long addr, long data) 53long arch_ptrace(struct task_struct *child, long request,
54 unsigned long addr, unsigned long data)
54{ 55{
55 int ret; 56 int ret;
57 int regno = addr >> 2;
58 unsigned long __user *datap = (unsigned long __user *) data;
56 59
57 switch (request) { 60 switch (request) {
58 /* read the word at location addr in the USER area. */ 61 /* read the word at location addr in the USER area. */
59 case PTRACE_PEEKUSR: { 62 case PTRACE_PEEKUSR: {
60 unsigned long tmp = 0; 63 unsigned long tmp = 0;
61 64
62 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 65 if ((addr & 3) || addr >= sizeof(struct user)) {
63 ret = -EIO; 66 ret = -EIO;
64 break ; 67 break ;
65 } 68 }
66 69
67 ret = 0; /* Default return condition */ 70 ret = 0; /* Default return condition */
68 addr = addr >> 2; /* temporary hack. */
69 71
70 if (addr < H8300_REGS_NO) 72 if (regno < H8300_REGS_NO)
71 tmp = h8300_get_reg(child, addr); 73 tmp = h8300_get_reg(child, regno);
72 else { 74 else {
73 switch(addr) { 75 switch (regno) {
74 case 49: 76 case 49:
75 tmp = child->mm->start_code; 77 tmp = child->mm->start_code;
76 break ; 78 break ;
@@ -88,24 +90,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
88 } 90 }
89 } 91 }
90 if (!ret) 92 if (!ret)
91 ret = put_user(tmp,(unsigned long *) data); 93 ret = put_user(tmp, datap);
92 break ; 94 break ;
93 } 95 }
94 96
95 /* when I and D space are separate, this will have to be fixed. */ 97 /* when I and D space are separate, this will have to be fixed. */
96 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 98 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
97 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 99 if ((addr & 3) || addr >= sizeof(struct user)) {
98 ret = -EIO; 100 ret = -EIO;
99 break ; 101 break ;
100 } 102 }
101 addr = addr >> 2; /* temporary hack. */
102 103
103 if (addr == PT_ORIG_ER0) { 104 if (regno == PT_ORIG_ER0) {
104 ret = -EIO; 105 ret = -EIO;
105 break ; 106 break ;
106 } 107 }
107 if (addr < H8300_REGS_NO) { 108 if (regno < H8300_REGS_NO) {
108 ret = h8300_put_reg(child, addr, data); 109 ret = h8300_put_reg(child, regno, data);
109 break ; 110 break ;
110 } 111 }
111 ret = -EIO; 112 ret = -EIO;
@@ -116,11 +117,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
116 unsigned long tmp; 117 unsigned long tmp;
117 for (i = 0; i < H8300_REGS_NO; i++) { 118 for (i = 0; i < H8300_REGS_NO; i++) {
118 tmp = h8300_get_reg(child, i); 119 tmp = h8300_get_reg(child, i);
119 if (put_user(tmp, (unsigned long *) data)) { 120 if (put_user(tmp, datap)) {
120 ret = -EFAULT; 121 ret = -EFAULT;
121 break; 122 break;
122 } 123 }
123 data += sizeof(long); 124 datap++;
124 } 125 }
125 ret = 0; 126 ret = 0;
126 break; 127 break;
@@ -130,12 +131,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
130 int i; 131 int i;
131 unsigned long tmp; 132 unsigned long tmp;
132 for (i = 0; i < H8300_REGS_NO; i++) { 133 for (i = 0; i < H8300_REGS_NO; i++) {
133 if (get_user(tmp, (unsigned long *) data)) { 134 if (get_user(tmp, datap)) {
134 ret = -EFAULT; 135 ret = -EFAULT;
135 break; 136 break;
136 } 137 }
137 h8300_put_reg(child, i, tmp); 138 h8300_put_reg(child, i, tmp);
138 data += sizeof(long); 139 datap++;
139 } 140 }
140 ret = 0; 141 ret = 0;
141 break; 142 break;