Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297596
b: refs/heads/master
c: 4394e28
h: refs/heads/master
v: v3
  • Loading branch information
Rabin Vincent authored and Russell King committed Mar 24, 2012
1 parent 1911e88 commit db3e433
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc283d7037555aa6891188719be2f1b4af9535c9
refs/heads/master: 4394e2824c8d97d81a336edb469b13c8806604e4
13 changes: 11 additions & 2 deletions trunk/arch/arm/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
#include <linux/uaccess.h>

#include <asm/cacheflush.h>
#include <asm/opcodes.h>
#include <asm/ftrace.h>

#ifdef CONFIG_THUMB2_KERNEL
#define NOP 0xeb04f85d /* pop.w {lr} */
#define NOP 0xf85deb04 /* pop.w {lr} */
#else
#define NOP 0xe8bd4000 /* pop {lr} */
#endif
Expand Down Expand Up @@ -88,7 +89,7 @@ static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
if (link)
second |= 1 << 14;

return (second << 16) | first;
return __opcode_thumb32_compose(first, second);
}
#else
static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
Expand Down Expand Up @@ -125,6 +126,14 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
{
unsigned long replaced;

if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
old = __opcode_to_mem_thumb32(old);
new = __opcode_to_mem_thumb32(new);
} else {
old = __opcode_to_mem_arm(old);
new = __opcode_to_mem_arm(new);
}

if (validate) {
if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
return -EFAULT;
Expand Down

0 comments on commit db3e433

Please sign in to comment.