diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/kgdb.c | 188 | ||||
-rw-r--r-- | arch/powerpc/kernel/kvm.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/ptrace.c | 66 |
3 files changed, 160 insertions, 96 deletions
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index 7f61a3ac787c..7a9db64f3f04 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c | |||
@@ -194,40 +194,6 @@ static int kgdb_dabr_match(struct pt_regs *regs) | |||
194 | ptr = (unsigned long *)ptr32; \ | 194 | ptr = (unsigned long *)ptr32; \ |
195 | } while (0) | 195 | } while (0) |
196 | 196 | ||
197 | |||
198 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | ||
199 | { | ||
200 | unsigned long *ptr = gdb_regs; | ||
201 | int reg; | ||
202 | |||
203 | memset(gdb_regs, 0, NUMREGBYTES); | ||
204 | |||
205 | for (reg = 0; reg < 32; reg++) | ||
206 | PACK64(ptr, regs->gpr[reg]); | ||
207 | |||
208 | #ifdef CONFIG_FSL_BOOKE | ||
209 | #ifdef CONFIG_SPE | ||
210 | for (reg = 0; reg < 32; reg++) | ||
211 | PACK64(ptr, current->thread.evr[reg]); | ||
212 | #else | ||
213 | ptr += 32; | ||
214 | #endif | ||
215 | #else | ||
216 | /* fp registers not used by kernel, leave zero */ | ||
217 | ptr += 32 * 8 / sizeof(long); | ||
218 | #endif | ||
219 | |||
220 | PACK64(ptr, regs->nip); | ||
221 | PACK64(ptr, regs->msr); | ||
222 | PACK32(ptr, regs->ccr); | ||
223 | PACK64(ptr, regs->link); | ||
224 | PACK64(ptr, regs->ctr); | ||
225 | PACK32(ptr, regs->xer); | ||
226 | |||
227 | BUG_ON((unsigned long)ptr > | ||
228 | (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); | ||
229 | } | ||
230 | |||
231 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | 197 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) |
232 | { | 198 | { |
233 | struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp + | 199 | struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp + |
@@ -271,44 +237,140 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | |||
271 | (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); | 237 | (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); |
272 | } | 238 | } |
273 | 239 | ||
274 | #define UNPACK64(dest, ptr) do { dest = *(ptr++); } while (0) | 240 | #define GDB_SIZEOF_REG sizeof(unsigned long) |
241 | #define GDB_SIZEOF_REG_U32 sizeof(u32) | ||
275 | 242 | ||
276 | #define UNPACK32(dest, ptr) do { \ | 243 | #ifdef CONFIG_FSL_BOOKE |
277 | u32 *ptr32; \ | 244 | #define GDB_SIZEOF_FLOAT_REG sizeof(unsigned long) |
278 | ptr32 = (u32 *)ptr; \ | 245 | #else |
279 | dest = *(ptr32++); \ | 246 | #define GDB_SIZEOF_FLOAT_REG sizeof(u64) |
280 | ptr = (unsigned long *)ptr32; \ | 247 | #endif |
281 | } while (0) | ||
282 | 248 | ||
283 | void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | 249 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = |
284 | { | 250 | { |
285 | unsigned long *ptr = gdb_regs; | 251 | { "r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[0]) }, |
286 | int reg; | 252 | { "r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[1]) }, |
287 | 253 | { "r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[2]) }, | |
288 | for (reg = 0; reg < 32; reg++) | 254 | { "r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[3]) }, |
289 | UNPACK64(regs->gpr[reg], ptr); | 255 | { "r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[4]) }, |
256 | { "r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[5]) }, | ||
257 | { "r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[6]) }, | ||
258 | { "r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[7]) }, | ||
259 | { "r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[8]) }, | ||
260 | { "r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[9]) }, | ||
261 | { "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[10]) }, | ||
262 | { "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[11]) }, | ||
263 | { "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[12]) }, | ||
264 | { "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[13]) }, | ||
265 | { "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[14]) }, | ||
266 | { "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[15]) }, | ||
267 | { "r16", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[16]) }, | ||
268 | { "r17", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[17]) }, | ||
269 | { "r18", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[18]) }, | ||
270 | { "r19", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[19]) }, | ||
271 | { "r20", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[20]) }, | ||
272 | { "r21", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[21]) }, | ||
273 | { "r22", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[22]) }, | ||
274 | { "r23", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[23]) }, | ||
275 | { "r24", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[24]) }, | ||
276 | { "r25", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[25]) }, | ||
277 | { "r26", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[26]) }, | ||
278 | { "r27", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[27]) }, | ||
279 | { "r28", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[28]) }, | ||
280 | { "r29", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[29]) }, | ||
281 | { "r30", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[30]) }, | ||
282 | { "r31", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[31]) }, | ||
283 | |||
284 | { "f0", GDB_SIZEOF_FLOAT_REG, 0 }, | ||
285 | { "f1", GDB_SIZEOF_FLOAT_REG, 1 }, | ||
286 | { "f2", GDB_SIZEOF_FLOAT_REG, 2 }, | ||
287 | { "f3", GDB_SIZEOF_FLOAT_REG, 3 }, | ||
288 | { "f4", GDB_SIZEOF_FLOAT_REG, 4 }, | ||
289 | { "f5", GDB_SIZEOF_FLOAT_REG, 5 }, | ||
290 | { "f6", GDB_SIZEOF_FLOAT_REG, 6 }, | ||
291 | { "f7", GDB_SIZEOF_FLOAT_REG, 7 }, | ||
292 | { "f8", GDB_SIZEOF_FLOAT_REG, 8 }, | ||
293 | { "f9", GDB_SIZEOF_FLOAT_REG, 9 }, | ||
294 | { "f10", GDB_SIZEOF_FLOAT_REG, 10 }, | ||
295 | { "f11", GDB_SIZEOF_FLOAT_REG, 11 }, | ||
296 | { "f12", GDB_SIZEOF_FLOAT_REG, 12 }, | ||
297 | { "f13", GDB_SIZEOF_FLOAT_REG, 13 }, | ||
298 | { "f14", GDB_SIZEOF_FLOAT_REG, 14 }, | ||
299 | { "f15", GDB_SIZEOF_FLOAT_REG, 15 }, | ||
300 | { "f16", GDB_SIZEOF_FLOAT_REG, 16 }, | ||
301 | { "f17", GDB_SIZEOF_FLOAT_REG, 17 }, | ||
302 | { "f18", GDB_SIZEOF_FLOAT_REG, 18 }, | ||
303 | { "f19", GDB_SIZEOF_FLOAT_REG, 19 }, | ||
304 | { "f20", GDB_SIZEOF_FLOAT_REG, 20 }, | ||
305 | { "f21", GDB_SIZEOF_FLOAT_REG, 21 }, | ||
306 | { "f22", GDB_SIZEOF_FLOAT_REG, 22 }, | ||
307 | { "f23", GDB_SIZEOF_FLOAT_REG, 23 }, | ||
308 | { "f24", GDB_SIZEOF_FLOAT_REG, 24 }, | ||
309 | { "f25", GDB_SIZEOF_FLOAT_REG, 25 }, | ||
310 | { "f26", GDB_SIZEOF_FLOAT_REG, 26 }, | ||
311 | { "f27", GDB_SIZEOF_FLOAT_REG, 27 }, | ||
312 | { "f28", GDB_SIZEOF_FLOAT_REG, 28 }, | ||
313 | { "f29", GDB_SIZEOF_FLOAT_REG, 29 }, | ||
314 | { "f30", GDB_SIZEOF_FLOAT_REG, 30 }, | ||
315 | { "f31", GDB_SIZEOF_FLOAT_REG, 31 }, | ||
316 | |||
317 | { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, nip) }, | ||
318 | { "msr", GDB_SIZEOF_REG, offsetof(struct pt_regs, msr) }, | ||
319 | { "cr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ccr) }, | ||
320 | { "lr", GDB_SIZEOF_REG, offsetof(struct pt_regs, link) }, | ||
321 | { "ctr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ctr) }, | ||
322 | { "xer", GDB_SIZEOF_REG, offsetof(struct pt_regs, xer) }, | ||
323 | }; | ||
290 | 324 | ||
291 | #ifdef CONFIG_FSL_BOOKE | 325 | char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs) |
292 | #ifdef CONFIG_SPE | 326 | { |
293 | for (reg = 0; reg < 32; reg++) | 327 | if (regno >= DBG_MAX_REG_NUM || regno < 0) |
294 | UNPACK64(current->thread.evr[reg], ptr); | 328 | return NULL; |
329 | |||
330 | if (regno < 32 || regno >= 64) | ||
331 | /* First 0 -> 31 gpr registers*/ | ||
332 | /* pc, msr, ls... registers 64 -> 69 */ | ||
333 | memcpy(mem, (void *)regs + dbg_reg_def[regno].offset, | ||
334 | dbg_reg_def[regno].size); | ||
335 | |||
336 | if (regno >= 32 && regno < 64) { | ||
337 | /* FP registers 32 -> 63 */ | ||
338 | #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE) | ||
339 | if (current) | ||
340 | memcpy(mem, current->thread.evr[regno-32], | ||
341 | dbg_reg_def[regno].size); | ||
295 | #else | 342 | #else |
296 | ptr += 32; | 343 | /* fp registers not used by kernel, leave zero */ |
344 | memset(mem, 0, dbg_reg_def[regno].size); | ||
297 | #endif | 345 | #endif |
346 | } | ||
347 | |||
348 | return dbg_reg_def[regno].name; | ||
349 | } | ||
350 | |||
351 | int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) | ||
352 | { | ||
353 | if (regno >= DBG_MAX_REG_NUM || regno < 0) | ||
354 | return -EINVAL; | ||
355 | |||
356 | if (regno < 32 || regno >= 64) | ||
357 | /* First 0 -> 31 gpr registers*/ | ||
358 | /* pc, msr, ls... registers 64 -> 69 */ | ||
359 | memcpy((void *)regs + dbg_reg_def[regno].offset, mem, | ||
360 | dbg_reg_def[regno].size); | ||
361 | |||
362 | if (regno >= 32 && regno < 64) { | ||
363 | /* FP registers 32 -> 63 */ | ||
364 | #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE) | ||
365 | memcpy(current->thread.evr[regno-32], mem, | ||
366 | dbg_reg_def[regno].size); | ||
298 | #else | 367 | #else |
299 | /* fp registers not used by kernel, leave zero */ | 368 | /* fp registers not used by kernel, leave zero */ |
300 | ptr += 32 * 8 / sizeof(int); | 369 | return 0; |
301 | #endif | 370 | #endif |
371 | } | ||
302 | 372 | ||
303 | UNPACK64(regs->nip, ptr); | 373 | return 0; |
304 | UNPACK64(regs->msr, ptr); | ||
305 | UNPACK32(regs->ccr, ptr); | ||
306 | UNPACK64(regs->link, ptr); | ||
307 | UNPACK64(regs->ctr, ptr); | ||
308 | UNPACK32(regs->xer, ptr); | ||
309 | |||
310 | BUG_ON((unsigned long)ptr > | ||
311 | (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); | ||
312 | } | 374 | } |
313 | 375 | ||
314 | void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) | 376 | void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) |
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 428d0e538aec..b06bdae04064 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c | |||
@@ -127,7 +127,7 @@ static void kvm_patch_ins_nop(u32 *inst) | |||
127 | 127 | ||
128 | static void kvm_patch_ins_b(u32 *inst, int addr) | 128 | static void kvm_patch_ins_b(u32 *inst, int addr) |
129 | { | 129 | { |
130 | #ifdef CONFIG_RELOCATABLE | 130 | #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_PPC_BOOK3S) |
131 | /* On relocatable kernels interrupts handlers and our code | 131 | /* On relocatable kernels interrupts handlers and our code |
132 | can be in different regions, so we don't patch them */ | 132 | can be in different regions, so we don't patch them */ |
133 | 133 | ||
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 286d9783d93f..a9b32967cff6 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -1406,37 +1406,42 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data) | |||
1406 | * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls, | 1406 | * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls, |
1407 | * we mark them as obsolete now, they will be removed in a future version | 1407 | * we mark them as obsolete now, they will be removed in a future version |
1408 | */ | 1408 | */ |
1409 | static long arch_ptrace_old(struct task_struct *child, long request, long addr, | 1409 | static long arch_ptrace_old(struct task_struct *child, long request, |
1410 | long data) | 1410 | unsigned long addr, unsigned long data) |
1411 | { | 1411 | { |
1412 | void __user *datavp = (void __user *) data; | ||
1413 | |||
1412 | switch (request) { | 1414 | switch (request) { |
1413 | case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */ | 1415 | case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */ |
1414 | return copy_regset_to_user(child, &user_ppc_native_view, | 1416 | return copy_regset_to_user(child, &user_ppc_native_view, |
1415 | REGSET_GPR, 0, 32 * sizeof(long), | 1417 | REGSET_GPR, 0, 32 * sizeof(long), |
1416 | (void __user *) data); | 1418 | datavp); |
1417 | 1419 | ||
1418 | case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */ | 1420 | case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */ |
1419 | return copy_regset_from_user(child, &user_ppc_native_view, | 1421 | return copy_regset_from_user(child, &user_ppc_native_view, |
1420 | REGSET_GPR, 0, 32 * sizeof(long), | 1422 | REGSET_GPR, 0, 32 * sizeof(long), |
1421 | (const void __user *) data); | 1423 | datavp); |
1422 | 1424 | ||
1423 | case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */ | 1425 | case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */ |
1424 | return copy_regset_to_user(child, &user_ppc_native_view, | 1426 | return copy_regset_to_user(child, &user_ppc_native_view, |
1425 | REGSET_FPR, 0, 32 * sizeof(double), | 1427 | REGSET_FPR, 0, 32 * sizeof(double), |
1426 | (void __user *) data); | 1428 | datavp); |
1427 | 1429 | ||
1428 | case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */ | 1430 | case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */ |
1429 | return copy_regset_from_user(child, &user_ppc_native_view, | 1431 | return copy_regset_from_user(child, &user_ppc_native_view, |
1430 | REGSET_FPR, 0, 32 * sizeof(double), | 1432 | REGSET_FPR, 0, 32 * sizeof(double), |
1431 | (const void __user *) data); | 1433 | datavp); |
1432 | } | 1434 | } |
1433 | 1435 | ||
1434 | return -EPERM; | 1436 | return -EPERM; |
1435 | } | 1437 | } |
1436 | 1438 | ||
1437 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 1439 | long arch_ptrace(struct task_struct *child, long request, |
1440 | unsigned long addr, unsigned long data) | ||
1438 | { | 1441 | { |
1439 | int ret = -EPERM; | 1442 | int ret = -EPERM; |
1443 | void __user *datavp = (void __user *) data; | ||
1444 | unsigned long __user *datalp = datavp; | ||
1440 | 1445 | ||
1441 | switch (request) { | 1446 | switch (request) { |
1442 | /* read the word at location addr in the USER area. */ | 1447 | /* read the word at location addr in the USER area. */ |
@@ -1446,11 +1451,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1446 | ret = -EIO; | 1451 | ret = -EIO; |
1447 | /* convert to index and check */ | 1452 | /* convert to index and check */ |
1448 | #ifdef CONFIG_PPC32 | 1453 | #ifdef CONFIG_PPC32 |
1449 | index = (unsigned long) addr >> 2; | 1454 | index = addr >> 2; |
1450 | if ((addr & 3) || (index > PT_FPSCR) | 1455 | if ((addr & 3) || (index > PT_FPSCR) |
1451 | || (child->thread.regs == NULL)) | 1456 | || (child->thread.regs == NULL)) |
1452 | #else | 1457 | #else |
1453 | index = (unsigned long) addr >> 3; | 1458 | index = addr >> 3; |
1454 | if ((addr & 7) || (index > PT_FPSCR)) | 1459 | if ((addr & 7) || (index > PT_FPSCR)) |
1455 | #endif | 1460 | #endif |
1456 | break; | 1461 | break; |
@@ -1463,7 +1468,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1463 | tmp = ((unsigned long *)child->thread.fpr) | 1468 | tmp = ((unsigned long *)child->thread.fpr) |
1464 | [TS_FPRWIDTH * (index - PT_FPR0)]; | 1469 | [TS_FPRWIDTH * (index - PT_FPR0)]; |
1465 | } | 1470 | } |
1466 | ret = put_user(tmp,(unsigned long __user *) data); | 1471 | ret = put_user(tmp, datalp); |
1467 | break; | 1472 | break; |
1468 | } | 1473 | } |
1469 | 1474 | ||
@@ -1474,11 +1479,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1474 | ret = -EIO; | 1479 | ret = -EIO; |
1475 | /* convert to index and check */ | 1480 | /* convert to index and check */ |
1476 | #ifdef CONFIG_PPC32 | 1481 | #ifdef CONFIG_PPC32 |
1477 | index = (unsigned long) addr >> 2; | 1482 | index = addr >> 2; |
1478 | if ((addr & 3) || (index > PT_FPSCR) | 1483 | if ((addr & 3) || (index > PT_FPSCR) |
1479 | || (child->thread.regs == NULL)) | 1484 | || (child->thread.regs == NULL)) |
1480 | #else | 1485 | #else |
1481 | index = (unsigned long) addr >> 3; | 1486 | index = addr >> 3; |
1482 | if ((addr & 7) || (index > PT_FPSCR)) | 1487 | if ((addr & 7) || (index > PT_FPSCR)) |
1483 | #endif | 1488 | #endif |
1484 | break; | 1489 | break; |
@@ -1525,11 +1530,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1525 | dbginfo.features = 0; | 1530 | dbginfo.features = 0; |
1526 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ | 1531 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ |
1527 | 1532 | ||
1528 | if (!access_ok(VERIFY_WRITE, data, | 1533 | if (!access_ok(VERIFY_WRITE, datavp, |
1529 | sizeof(struct ppc_debug_info))) | 1534 | sizeof(struct ppc_debug_info))) |
1530 | return -EFAULT; | 1535 | return -EFAULT; |
1531 | ret = __copy_to_user((struct ppc_debug_info __user *)data, | 1536 | ret = __copy_to_user(datavp, &dbginfo, |
1532 | &dbginfo, sizeof(struct ppc_debug_info)) ? | 1537 | sizeof(struct ppc_debug_info)) ? |
1533 | -EFAULT : 0; | 1538 | -EFAULT : 0; |
1534 | break; | 1539 | break; |
1535 | } | 1540 | } |
@@ -1537,11 +1542,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1537 | case PPC_PTRACE_SETHWDEBUG: { | 1542 | case PPC_PTRACE_SETHWDEBUG: { |
1538 | struct ppc_hw_breakpoint bp_info; | 1543 | struct ppc_hw_breakpoint bp_info; |
1539 | 1544 | ||
1540 | if (!access_ok(VERIFY_READ, data, | 1545 | if (!access_ok(VERIFY_READ, datavp, |
1541 | sizeof(struct ppc_hw_breakpoint))) | 1546 | sizeof(struct ppc_hw_breakpoint))) |
1542 | return -EFAULT; | 1547 | return -EFAULT; |
1543 | ret = __copy_from_user(&bp_info, | 1548 | ret = __copy_from_user(&bp_info, datavp, |
1544 | (struct ppc_hw_breakpoint __user *)data, | ||
1545 | sizeof(struct ppc_hw_breakpoint)) ? | 1549 | sizeof(struct ppc_hw_breakpoint)) ? |
1546 | -EFAULT : 0; | 1550 | -EFAULT : 0; |
1547 | if (!ret) | 1551 | if (!ret) |
@@ -1560,11 +1564,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1560 | if (addr > 0) | 1564 | if (addr > 0) |
1561 | break; | 1565 | break; |
1562 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | 1566 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS |
1563 | ret = put_user(child->thread.dac1, | 1567 | ret = put_user(child->thread.dac1, datalp); |
1564 | (unsigned long __user *)data); | ||
1565 | #else | 1568 | #else |
1566 | ret = put_user(child->thread.dabr, | 1569 | ret = put_user(child->thread.dabr, datalp); |
1567 | (unsigned long __user *)data); | ||
1568 | #endif | 1570 | #endif |
1569 | break; | 1571 | break; |
1570 | } | 1572 | } |
@@ -1580,7 +1582,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1580 | return copy_regset_to_user(child, &user_ppc_native_view, | 1582 | return copy_regset_to_user(child, &user_ppc_native_view, |
1581 | REGSET_GPR, | 1583 | REGSET_GPR, |
1582 | 0, sizeof(struct pt_regs), | 1584 | 0, sizeof(struct pt_regs), |
1583 | (void __user *) data); | 1585 | datavp); |
1584 | 1586 | ||
1585 | #ifdef CONFIG_PPC64 | 1587 | #ifdef CONFIG_PPC64 |
1586 | case PTRACE_SETREGS64: | 1588 | case PTRACE_SETREGS64: |
@@ -1589,19 +1591,19 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1589 | return copy_regset_from_user(child, &user_ppc_native_view, | 1591 | return copy_regset_from_user(child, &user_ppc_native_view, |
1590 | REGSET_GPR, | 1592 | REGSET_GPR, |
1591 | 0, sizeof(struct pt_regs), | 1593 | 0, sizeof(struct pt_regs), |
1592 | (const void __user *) data); | 1594 | datavp); |
1593 | 1595 | ||
1594 | case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */ | 1596 | case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */ |
1595 | return copy_regset_to_user(child, &user_ppc_native_view, | 1597 | return copy_regset_to_user(child, &user_ppc_native_view, |
1596 | REGSET_FPR, | 1598 | REGSET_FPR, |
1597 | 0, sizeof(elf_fpregset_t), | 1599 | 0, sizeof(elf_fpregset_t), |
1598 | (void __user *) data); | 1600 | datavp); |
1599 | 1601 | ||
1600 | case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */ | 1602 | case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */ |
1601 | return copy_regset_from_user(child, &user_ppc_native_view, | 1603 | return copy_regset_from_user(child, &user_ppc_native_view, |
1602 | REGSET_FPR, | 1604 | REGSET_FPR, |
1603 | 0, sizeof(elf_fpregset_t), | 1605 | 0, sizeof(elf_fpregset_t), |
1604 | (const void __user *) data); | 1606 | datavp); |
1605 | 1607 | ||
1606 | #ifdef CONFIG_ALTIVEC | 1608 | #ifdef CONFIG_ALTIVEC |
1607 | case PTRACE_GETVRREGS: | 1609 | case PTRACE_GETVRREGS: |
@@ -1609,40 +1611,40 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1609 | REGSET_VMX, | 1611 | REGSET_VMX, |
1610 | 0, (33 * sizeof(vector128) + | 1612 | 0, (33 * sizeof(vector128) + |
1611 | sizeof(u32)), | 1613 | sizeof(u32)), |
1612 | (void __user *) data); | 1614 | datavp); |
1613 | 1615 | ||
1614 | case PTRACE_SETVRREGS: | 1616 | case PTRACE_SETVRREGS: |
1615 | return copy_regset_from_user(child, &user_ppc_native_view, | 1617 | return copy_regset_from_user(child, &user_ppc_native_view, |
1616 | REGSET_VMX, | 1618 | REGSET_VMX, |
1617 | 0, (33 * sizeof(vector128) + | 1619 | 0, (33 * sizeof(vector128) + |
1618 | sizeof(u32)), | 1620 | sizeof(u32)), |
1619 | (const void __user *) data); | 1621 | datavp); |
1620 | #endif | 1622 | #endif |
1621 | #ifdef CONFIG_VSX | 1623 | #ifdef CONFIG_VSX |
1622 | case PTRACE_GETVSRREGS: | 1624 | case PTRACE_GETVSRREGS: |
1623 | return copy_regset_to_user(child, &user_ppc_native_view, | 1625 | return copy_regset_to_user(child, &user_ppc_native_view, |
1624 | REGSET_VSX, | 1626 | REGSET_VSX, |
1625 | 0, 32 * sizeof(double), | 1627 | 0, 32 * sizeof(double), |
1626 | (void __user *) data); | 1628 | datavp); |
1627 | 1629 | ||
1628 | case PTRACE_SETVSRREGS: | 1630 | case PTRACE_SETVSRREGS: |
1629 | return copy_regset_from_user(child, &user_ppc_native_view, | 1631 | return copy_regset_from_user(child, &user_ppc_native_view, |
1630 | REGSET_VSX, | 1632 | REGSET_VSX, |
1631 | 0, 32 * sizeof(double), | 1633 | 0, 32 * sizeof(double), |
1632 | (const void __user *) data); | 1634 | datavp); |
1633 | #endif | 1635 | #endif |
1634 | #ifdef CONFIG_SPE | 1636 | #ifdef CONFIG_SPE |
1635 | case PTRACE_GETEVRREGS: | 1637 | case PTRACE_GETEVRREGS: |
1636 | /* Get the child spe register state. */ | 1638 | /* Get the child spe register state. */ |
1637 | return copy_regset_to_user(child, &user_ppc_native_view, | 1639 | return copy_regset_to_user(child, &user_ppc_native_view, |
1638 | REGSET_SPE, 0, 35 * sizeof(u32), | 1640 | REGSET_SPE, 0, 35 * sizeof(u32), |
1639 | (void __user *) data); | 1641 | datavp); |
1640 | 1642 | ||
1641 | case PTRACE_SETEVRREGS: | 1643 | case PTRACE_SETEVRREGS: |
1642 | /* Set the child spe register state. */ | 1644 | /* Set the child spe register state. */ |
1643 | return copy_regset_from_user(child, &user_ppc_native_view, | 1645 | return copy_regset_from_user(child, &user_ppc_native_view, |
1644 | REGSET_SPE, 0, 35 * sizeof(u32), | 1646 | REGSET_SPE, 0, 35 * sizeof(u32), |
1645 | (const void __user *) data); | 1647 | datavp); |
1646 | #endif | 1648 | #endif |
1647 | 1649 | ||
1648 | /* Old reverse args ptrace callss */ | 1650 | /* Old reverse args ptrace callss */ |