aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v32')
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 3e058a121753..511ece94a574 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -130,6 +130,7 @@ long arch_ptrace(struct task_struct *child, long request,
130 unsigned long addr, unsigned long data) 130 unsigned long addr, unsigned long data)
131{ 131{
132 int ret; 132 int ret;
133 unsigned int regno = addr >> 2;
133 unsigned long __user *datap = (unsigned long __user *)data; 134 unsigned long __user *datap = (unsigned long __user *)data;
134 135
135 switch (request) { 136 switch (request) {
@@ -164,10 +165,10 @@ long arch_ptrace(struct task_struct *child, long request,
164 unsigned long tmp; 165 unsigned long tmp;
165 166
166 ret = -EIO; 167 ret = -EIO;
167 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 168 if ((addr & 3) || regno > PT_MAX)
168 break; 169 break;
169 170
170 tmp = get_reg(child, addr >> 2); 171 tmp = get_reg(child, regno);
171 ret = put_user(tmp, datap); 172 ret = put_user(tmp, datap);
172 break; 173 break;
173 } 174 }
@@ -181,19 +182,17 @@ long arch_ptrace(struct task_struct *child, long request,
181 /* Write the word at location address in the USER area. */ 182 /* Write the word at location address in the USER area. */
182 case PTRACE_POKEUSR: 183 case PTRACE_POKEUSR:
183 ret = -EIO; 184 ret = -EIO;
184 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 185 if ((addr & 3) || regno > PT_MAX)
185 break; 186 break;
186 187
187 addr >>= 2; 188 if (regno == PT_CCS) {
188
189 if (addr == PT_CCS) {
190 /* don't allow the tracing process to change stuff like 189 /* don't allow the tracing process to change stuff like
191 * interrupt enable, kernel/user bit, dma enables etc. 190 * interrupt enable, kernel/user bit, dma enables etc.
192 */ 191 */
193 data &= CCS_MASK; 192 data &= CCS_MASK;
194 data |= get_reg(child, PT_CCS) & ~CCS_MASK; 193 data |= get_reg(child, PT_CCS) & ~CCS_MASK;
195 } 194 }
196 if (put_reg(child, addr, data)) 195 if (put_reg(child, regno, data))
197 break; 196 break;
198 ret = 0; 197 ret = 0;
199 break; 198 break;