Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258343
b: refs/heads/master
c: a9c3c29
h: refs/heads/master
i:
  258341: 213029e
  258339: b358bac
  258335: ad50c0a
v: v3
  • Loading branch information
Jon Medhurst authored and Tixy committed Jul 13, 2011
1 parent ff34123 commit 8091206
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 059987ffa7f8905fada25c8af1734e254209c55d
refs/heads/master: a9c3c29e72cc459be0ecd597f0af11a67713175b
37 changes: 37 additions & 0 deletions trunk/arch/arm/kernel/kprobes-thumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@
*/
#define current_cond(cpsr) ((cpsr >> 12) & 0xf)

/*
* Return the PC value for a probe in thumb code.
* This is the address of the probed instruction plus 4.
* We subtract one because the address will have bit zero set to indicate
* a pointer to thumb code.
*/
static inline unsigned long __kprobes thumb_probe_pc(struct kprobe *p)
{
return (unsigned long)p->addr - 1 + 4;
}

static void __kprobes
t16_simulate_bxblx(struct kprobe *p, struct pt_regs *regs)
{
kprobe_opcode_t insn = p->opcode;
unsigned long pc = thumb_probe_pc(p);
int rm = (insn >> 3) & 0xf;
unsigned long rmv = (rm == 15) ? pc : regs->uregs[rm];

if (insn & (1 << 7)) /* BLX ? */
regs->ARM_lr = (unsigned long)p->addr + 2;

bx_write_pc(rmv, regs);
}

static unsigned long __kprobes
t16_emulate_loregs(struct kprobe *p, struct pt_regs *regs)
{
Expand Down Expand Up @@ -131,6 +156,18 @@ const union decode_item kprobe_decode_thumb16_table[] = {
/* MVN (register) 0100 0011 10xx xxxx */
DECODE_EMULATE (0xfc00, 0x4000, t16_emulate_loregs_noitrwflags),

/*
* Special data instructions and branch and exchange
* 0100 01xx xxxx xxxx
*/

/* BLX pc 0100 0111 1111 1xxx */
DECODE_REJECT (0xfff8, 0x47f8),

/* BX (register) 0100 0111 0xxx xxxx */
/* BLX (register) 0100 0111 1xxx xxxx */
DECODE_SIMULATE (0xff00, 0x4700, t16_simulate_bxblx),

/*
* Miscellaneous 16-bit instructions
* 1011 xxxx xxxx xxxx
Expand Down

0 comments on commit 8091206

Please sign in to comment.