diff options
author | Shaohua Li <shaohua.li@intel.com> | 2009-01-08 22:29:49 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-14 06:11:31 -0500 |
commit | a14a07b8018b714e03a39ff2180c66e307ef4238 (patch) | |
tree | 7c4b9249f862969b80b74e5e11e56480b0e3d15c /arch/ia64/kernel/entry.S | |
parent | d3e75ff14bc1453c4762428395aac9953a023efc (diff) |
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>
Diffstat (limited to 'arch/ia64/kernel/entry.S')
-rw-r--r-- | arch/ia64/kernel/entry.S | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index c2f7d798e2a5..e0be92a6abb0 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1406,6 +1406,56 @@ GLOBAL_ENTRY(unw_init_running) | |||
1406 | END(unw_init_running) | 1406 | END(unw_init_running) |
1407 | 1407 | ||
1408 | #ifdef CONFIG_FUNCTION_TRACER | 1408 | #ifdef CONFIG_FUNCTION_TRACER |
1409 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
1410 | GLOBAL_ENTRY(_mcount) | ||
1411 | br ftrace_stub | ||
1412 | END(_mcount) | ||
1413 | |||
1414 | .here: | ||
1415 | br.ret.sptk.many b0 | ||
1416 | |||
1417 | GLOBAL_ENTRY(ftrace_caller) | ||
1418 | alloc out0 = ar.pfs, 8, 0, 4, 0 | ||
1419 | mov out3 = r0 | ||
1420 | ;; | ||
1421 | mov out2 = b0 | ||
1422 | add r3 = 0x20, r3 | ||
1423 | mov out1 = r1; | ||
1424 | br.call.sptk.many b0 = ftrace_patch_gp | ||
1425 | //this might be called from module, so we must patch gp | ||
1426 | ftrace_patch_gp: | ||
1427 | movl gp=__gp | ||
1428 | mov b0 = r3 | ||
1429 | ;; | ||
1430 | .global ftrace_call; | ||
1431 | ftrace_call: | ||
1432 | { | ||
1433 | .mlx | ||
1434 | nop.m 0x0 | ||
1435 | movl r3 = .here;; | ||
1436 | } | ||
1437 | alloc loc0 = ar.pfs, 4, 4, 2, 0 | ||
1438 | ;; | ||
1439 | mov loc1 = b0 | ||
1440 | mov out0 = b0 | ||
1441 | mov loc2 = r8 | ||
1442 | mov loc3 = r15 | ||
1443 | ;; | ||
1444 | adds out0 = -MCOUNT_INSN_SIZE, out0 | ||
1445 | mov out1 = in2 | ||
1446 | mov b6 = r3 | ||
1447 | |||
1448 | br.call.sptk.many b0 = b6 | ||
1449 | ;; | ||
1450 | mov ar.pfs = loc0 | ||
1451 | mov b0 = loc1 | ||
1452 | mov r8 = loc2 | ||
1453 | mov r15 = loc3 | ||
1454 | br ftrace_stub | ||
1455 | ;; | ||
1456 | END(ftrace_caller) | ||
1457 | |||
1458 | #else | ||
1409 | GLOBAL_ENTRY(_mcount) | 1459 | GLOBAL_ENTRY(_mcount) |
1410 | movl r2 = ftrace_stub | 1460 | movl r2 = ftrace_stub |
1411 | movl r3 = ftrace_trace_function;; | 1461 | movl r3 = ftrace_trace_function;; |
@@ -1435,6 +1485,7 @@ GLOBAL_ENTRY(_mcount) | |||
1435 | br ftrace_stub | 1485 | br ftrace_stub |
1436 | ;; | 1486 | ;; |
1437 | END(_mcount) | 1487 | END(_mcount) |
1488 | #endif | ||
1438 | 1489 | ||
1439 | GLOBAL_ENTRY(ftrace_stub) | 1490 | GLOBAL_ENTRY(ftrace_stub) |
1440 | mov r3 = b0 | 1491 | mov r3 = b0 |