[PATCH 2/4] ARM: extract out insn generation code from ftrace

Dave Martin dave.martin at linaro.org
Tue Nov 22 07:02:52 EST 2011


On Mon, Nov 21, 2011 at 08:43:47PM +0530, Rabin Vincent wrote:
> Extract out the instruction generation code so that it can be used
> for jump labels too.
> 
> Signed-off-by: Rabin Vincent <rabin at rab.in>
> ---
>  arch/arm/kernel/Makefile |    5 ++-
>  arch/arm/kernel/ftrace.c |   61 +++-------------------------------------------
>  arch/arm/kernel/insn.c   |   60 +++++++++++++++++++++++++++++++++++++++++++++
>  arch/arm/kernel/insn.h   |   19 ++++++++++++++
>  4 files changed, 86 insertions(+), 59 deletions(-)
>  create mode 100644 arch/arm/kernel/insn.c
>  create mode 100644 arch/arm/kernel/insn.h
> 
> diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile

[...]

>  static int ftrace_modify_code(unsigned long pc, unsigned long old,
> @@ -256,7 +203,7 @@ static int __ftrace_modify_caller(unsigned long *callsite,
>  {
>  	unsigned long caller_fn = (unsigned long) func;
>  	unsigned long pc = (unsigned long) callsite;
> -	unsigned long branch = ftrace_gen_branch(pc, caller_fn, false);
> +	unsigned long branch = arm_gen_branch(pc, caller_fn);
>  	unsigned long nop = 0xe1a00000;	/* mov r0, r0 */

Does this code get used in Thumb-2 kernels?  So far as I can tell, this
code is used... but it looks like it shouldn't work, due to the ARM
specifics.

Cheers
---Dave



More information about the linux-arm-kernel mailing list