ftrace, ia64: IA64 dynamic ftrace support
IA64 dynamic ftrace support. The original _mcount stub for each function is like: alloc r40=ar.pfs,12,8,0 mov r43=r0;; mov r42=b0 mov r41=r1 nop.i 0x0 br.call.sptk.many b0 = _mcount;; The patch convert it to below for nop: [MII] nop.m 0x0 mov r3=ip nop.i 0x0 [MLX] nop.m 0x0 nop.x 0x0;; This isn't completely nop, as there is one instuction 'mov r3=ip', but it should be light and harmless for code follow it. And below is for call [MII] nop.m 0x0 mov r3=ip nop.i 0x0 [MLX] nop.m 0x0 brl.many .;; In this way, only one instruction is changed to convert code between nop and call. This should meet dyn-ftrace's requirement. But this requires CPU support brl instruction, so dyn-ftrace isn't supported for old Itanium system. Assume there are quite few such old system running. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -1406,6 +1406,56 @@ GLOBAL_ENTRY(unw_init_running)
|
||||
END(unw_init_running)
|
||||
|
||||
#ifdef CONFIG_FUNCTION_TRACER
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||
GLOBAL_ENTRY(_mcount)
|
||||
br ftrace_stub
|
||||
END(_mcount)
|
||||
|
||||
.here:
|
||||
br.ret.sptk.many b0
|
||||
|
||||
GLOBAL_ENTRY(ftrace_caller)
|
||||
alloc out0 = ar.pfs, 8, 0, 4, 0
|
||||
mov out3 = r0
|
||||
;;
|
||||
mov out2 = b0
|
||||
add r3 = 0x20, r3
|
||||
mov out1 = r1;
|
||||
br.call.sptk.many b0 = ftrace_patch_gp
|
||||
//this might be called from module, so we must patch gp
|
||||
ftrace_patch_gp:
|
||||
movl gp=__gp
|
||||
mov b0 = r3
|
||||
;;
|
||||
.global ftrace_call;
|
||||
ftrace_call:
|
||||
{
|
||||
.mlx
|
||||
nop.m 0x0
|
||||
movl r3 = .here;;
|
||||
}
|
||||
alloc loc0 = ar.pfs, 4, 4, 2, 0
|
||||
;;
|
||||
mov loc1 = b0
|
||||
mov out0 = b0
|
||||
mov loc2 = r8
|
||||
mov loc3 = r15
|
||||
;;
|
||||
adds out0 = -MCOUNT_INSN_SIZE, out0
|
||||
mov out1 = in2
|
||||
mov b6 = r3
|
||||
|
||||
br.call.sptk.many b0 = b6
|
||||
;;
|
||||
mov ar.pfs = loc0
|
||||
mov b0 = loc1
|
||||
mov r8 = loc2
|
||||
mov r15 = loc3
|
||||
br ftrace_stub
|
||||
;;
|
||||
END(ftrace_caller)
|
||||
|
||||
#else
|
||||
GLOBAL_ENTRY(_mcount)
|
||||
movl r2 = ftrace_stub
|
||||
movl r3 = ftrace_trace_function;;
|
||||
@@ -1435,6 +1485,7 @@ GLOBAL_ENTRY(_mcount)
|
||||
br ftrace_stub
|
||||
;;
|
||||
END(_mcount)
|
||||
#endif
|
||||
|
||||
GLOBAL_ENTRY(ftrace_stub)
|
||||
mov r3 = b0
|
||||
|
Reference in New Issue
Block a user