diff options
| author | Daniel Jacobowitz <dan@codesourcery.com> | 2010-02-02 12:22:16 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:39:52 -0500 |
| commit | d23bc1b3a7e6db935acb9a949a5985d9b77dfd13 (patch) | |
| tree | 878b262eff95267cbd3b125885ff7bad21e25b89 | |
| parent | 1a28e3d977860dc760909083df625b300f695680 (diff) | |
ARM: 5912/1: Define a 32-bit Thumb-2 breakpoint instruction
Recognize 0xf7f0 0xa000 as a 32-bit breakpoint instruction for
Thumb-2.
Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/kernel/ptrace.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index a2ea3854cb3c..bd56673c6a69 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
| @@ -499,10 +499,41 @@ static struct undef_hook thumb_break_hook = { | |||
| 499 | .fn = break_trap, | 499 | .fn = break_trap, |
| 500 | }; | 500 | }; |
| 501 | 501 | ||
| 502 | static int thumb2_break_trap(struct pt_regs *regs, unsigned int instr) | ||
| 503 | { | ||
| 504 | unsigned int instr2; | ||
| 505 | void __user *pc; | ||
| 506 | |||
| 507 | /* Check the second half of the instruction. */ | ||
| 508 | pc = (void __user *)(instruction_pointer(regs) + 2); | ||
| 509 | |||
| 510 | if (processor_mode(regs) == SVC_MODE) { | ||
| 511 | instr2 = *(u16 *) pc; | ||
| 512 | } else { | ||
| 513 | get_user(instr2, (u16 __user *)pc); | ||
| 514 | } | ||
| 515 | |||
| 516 | if (instr2 == 0xa000) { | ||
| 517 | ptrace_break(current, regs); | ||
| 518 | return 0; | ||
| 519 | } else { | ||
| 520 | return 1; | ||
| 521 | } | ||
| 522 | } | ||
| 523 | |||
| 524 | static struct undef_hook thumb2_break_hook = { | ||
| 525 | .instr_mask = 0xffff, | ||
| 526 | .instr_val = 0xf7f0, | ||
| 527 | .cpsr_mask = PSR_T_BIT, | ||
| 528 | .cpsr_val = PSR_T_BIT, | ||
| 529 | .fn = thumb2_break_trap, | ||
| 530 | }; | ||
| 531 | |||
| 502 | static int __init ptrace_break_init(void) | 532 | static int __init ptrace_break_init(void) |
| 503 | { | 533 | { |
| 504 | register_undef_hook(&arm_break_hook); | 534 | register_undef_hook(&arm_break_hook); |
| 505 | register_undef_hook(&thumb_break_hook); | 535 | register_undef_hook(&thumb_break_hook); |
| 536 | register_undef_hook(&thumb2_break_hook); | ||
| 506 | return 0; | 537 | return 0; |
| 507 | } | 538 | } |
| 508 | 539 | ||
