diff options
Diffstat (limited to 'arch/m68k/kernel/ptrace.c')
| -rw-r--r-- | arch/m68k/kernel/ptrace.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index 616e59752c29..0b252683cefb 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c | |||
| @@ -156,55 +156,57 @@ void user_disable_single_step(struct task_struct *child) | |||
| 156 | singlestep_disable(child); | 156 | singlestep_disable(child); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 159 | long arch_ptrace(struct task_struct *child, long request, |
| 160 | unsigned long addr, unsigned long data) | ||
| 160 | { | 161 | { |
| 161 | unsigned long tmp; | 162 | unsigned long tmp; |
| 162 | int i, ret = 0; | 163 | int i, ret = 0; |
| 164 | int regno = addr >> 2; /* temporary hack. */ | ||
| 165 | unsigned long __user *datap = (unsigned long __user *) data; | ||
| 163 | 166 | ||
| 164 | switch (request) { | 167 | switch (request) { |
| 165 | /* read the word at location addr in the USER area. */ | 168 | /* read the word at location addr in the USER area. */ |
| 166 | case PTRACE_PEEKUSR: | 169 | case PTRACE_PEEKUSR: |
| 167 | if (addr & 3) | 170 | if (addr & 3) |
| 168 | goto out_eio; | 171 | goto out_eio; |
| 169 | addr >>= 2; /* temporary hack. */ | ||
| 170 | 172 | ||
| 171 | if (addr >= 0 && addr < 19) { | 173 | if (regno >= 0 && regno < 19) { |
| 172 | tmp = get_reg(child, addr); | 174 | tmp = get_reg(child, regno); |
| 173 | } else if (addr >= 21 && addr < 49) { | 175 | } else if (regno >= 21 && regno < 49) { |
| 174 | tmp = child->thread.fp[addr - 21]; | 176 | tmp = child->thread.fp[regno - 21]; |
| 175 | /* Convert internal fpu reg representation | 177 | /* Convert internal fpu reg representation |
| 176 | * into long double format | 178 | * into long double format |
| 177 | */ | 179 | */ |
| 178 | if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) | 180 | if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) |
| 179 | tmp = ((tmp & 0xffff0000) << 15) | | 181 | tmp = ((tmp & 0xffff0000) << 15) | |
| 180 | ((tmp & 0x0000ffff) << 16); | 182 | ((tmp & 0x0000ffff) << 16); |
| 181 | } else | 183 | } else |
| 182 | goto out_eio; | 184 | goto out_eio; |
| 183 | ret = put_user(tmp, (unsigned long *)data); | 185 | ret = put_user(tmp, datap); |
| 184 | break; | 186 | break; |
| 185 | 187 | ||
| 186 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ | 188 | case PTRACE_POKEUSR: |
| 189 | /* write the word at location addr in the USER area */ | ||
| 187 | if (addr & 3) | 190 | if (addr & 3) |
| 188 | goto out_eio; | 191 | goto out_eio; |
| 189 | addr >>= 2; /* temporary hack. */ | ||
| 190 | 192 | ||
| 191 | if (addr == PT_SR) { | 193 | if (regno == PT_SR) { |
| 192 | data &= SR_MASK; | 194 | data &= SR_MASK; |
| 193 | data |= get_reg(child, PT_SR) & ~SR_MASK; | 195 | data |= get_reg(child, PT_SR) & ~SR_MASK; |
| 194 | } | 196 | } |
| 195 | if (addr >= 0 && addr < 19) { | 197 | if (regno >= 0 && regno < 19) { |
| 196 | if (put_reg(child, addr, data)) | 198 | if (put_reg(child, regno, data)) |
| 197 | goto out_eio; | 199 | goto out_eio; |
| 198 | } else if (addr >= 21 && addr < 48) { | 200 | } else if (regno >= 21 && regno < 48) { |
| 199 | /* Convert long double format | 201 | /* Convert long double format |
| 200 | * into internal fpu reg representation | 202 | * into internal fpu reg representation |
| 201 | */ | 203 | */ |
| 202 | if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) { | 204 | if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) { |
| 203 | data = (unsigned long)data << 15; | 205 | data <<= 15; |
| 204 | data = (data & 0xffff0000) | | 206 | data = (data & 0xffff0000) | |
| 205 | ((data & 0x0000ffff) >> 1); | 207 | ((data & 0x0000ffff) >> 1); |
| 206 | } | 208 | } |
| 207 | child->thread.fp[addr - 21] = data; | 209 | child->thread.fp[regno - 21] = data; |
| 208 | } else | 210 | } else |
| 209 | goto out_eio; | 211 | goto out_eio; |
| 210 | break; | 212 | break; |
| @@ -212,16 +214,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
| 212 | case PTRACE_GETREGS: /* Get all gp regs from the child. */ | 214 | case PTRACE_GETREGS: /* Get all gp regs from the child. */ |
| 213 | for (i = 0; i < 19; i++) { | 215 | for (i = 0; i < 19; i++) { |
| 214 | tmp = get_reg(child, i); | 216 | tmp = get_reg(child, i); |
| 215 | ret = put_user(tmp, (unsigned long *)data); | 217 | ret = put_user(tmp, datap); |
| 216 | if (ret) | 218 | if (ret) |
| 217 | break; | 219 | break; |
| 218 | data += sizeof(long); | 220 | datap++; |
| 219 | } | 221 | } |
| 220 | break; | 222 | break; |
| 221 | 223 | ||
| 222 | case PTRACE_SETREGS: /* Set all gp regs in the child. */ | 224 | case PTRACE_SETREGS: /* Set all gp regs in the child. */ |
| 223 | for (i = 0; i < 19; i++) { | 225 | for (i = 0; i < 19; i++) { |
| 224 | ret = get_user(tmp, (unsigned long *)data); | 226 | ret = get_user(tmp, datap); |
| 225 | if (ret) | 227 | if (ret) |
| 226 | break; | 228 | break; |
| 227 | if (i == PT_SR) { | 229 | if (i == PT_SR) { |
| @@ -229,25 +231,24 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
| 229 | tmp |= get_reg(child, PT_SR) & ~SR_MASK; | 231 | tmp |= get_reg(child, PT_SR) & ~SR_MASK; |
| 230 | } | 232 | } |
| 231 | put_reg(child, i, tmp); | 233 | put_reg(child, i, tmp); |
| 232 | data += sizeof(long); | 234 | datap++; |
| 233 | } | 235 | } |
| 234 | break; | 236 | break; |
| 235 | 237 | ||
| 236 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ | 238 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ |
| 237 | if (copy_to_user((void *)data, &child->thread.fp, | 239 | if (copy_to_user(datap, &child->thread.fp, |
| 238 | sizeof(struct user_m68kfp_struct))) | 240 | sizeof(struct user_m68kfp_struct))) |
| 239 | ret = -EFAULT; | 241 | ret = -EFAULT; |
| 240 | break; | 242 | break; |
| 241 | 243 | ||
| 242 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ | 244 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ |
| 243 | if (copy_from_user(&child->thread.fp, (void *)data, | 245 | if (copy_from_user(&child->thread.fp, datap, |
| 244 | sizeof(struct user_m68kfp_struct))) | 246 | sizeof(struct user_m68kfp_struct))) |
| 245 | ret = -EFAULT; | 247 | ret = -EFAULT; |
| 246 | break; | 248 | break; |
| 247 | 249 | ||
| 248 | case PTRACE_GET_THREAD_AREA: | 250 | case PTRACE_GET_THREAD_AREA: |
| 249 | ret = put_user(task_thread_info(child)->tp_value, | 251 | ret = put_user(task_thread_info(child)->tp_value, datap); |
| 250 | (unsigned long __user *)data); | ||
| 251 | break; | 252 | break; |
| 252 | 253 | ||
| 253 | default: | 254 | default: |
