Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright IBM Corp. 2008,2009 |
| 3 | * |
| 4 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, |
| 5 | * |
| 6 | */ |
| 7 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 8 | #include <linux/linkage.h> |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 9 | #include <asm/asm-offsets.h> |
| 10 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 11 | .section .kprobes.text, "ax" |
| 12 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 13 | ENTRY(ftrace_stub) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 14 | br %r14 |
| 15 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 16 | ENTRY(_mcount) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 18 | br %r14 |
| 19 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 20 | ENTRY(ftrace_caller) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 21 | #endif |
| 22 | larl %r1,function_trace_stop |
| 23 | icm %r1,0xf,0(%r1) |
| 24 | bnzr %r14 |
| 25 | stmg %r2,%r5,32(%r15) |
| 26 | stg %r14,112(%r15) |
| 27 | lgr %r1,%r15 |
| 28 | aghi %r15,-160 |
| 29 | stg %r1,__SF_BACKCHAIN(%r15) |
| 30 | lgr %r2,%r14 |
| 31 | lg %r3,168(%r15) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 32 | larl %r14,ftrace_trace_function |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 33 | lg %r14,0(%r14) |
| 34 | basr %r14,%r14 |
| 35 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
Martin Schwidefsky | 4cc9bed | 2011-01-05 12:48:11 +0100 | [diff] [blame] | 36 | lg %r2,168(%r15) |
| 37 | lg %r3,272(%r15) |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 38 | ENTRY(ftrace_graph_caller) |
Martin Schwidefsky | 4cc9bed | 2011-01-05 12:48:11 +0100 | [diff] [blame] | 39 | # The bras instruction gets runtime patched to call prepare_ftrace_return. |
| 40 | # See ftrace_enable_ftrace_graph_caller. The patched instruction is: |
| 41 | # bras %r14,prepare_ftrace_return |
| 42 | bras %r14,0f |
| 43 | 0: stg %r2,168(%r15) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 44 | #endif |
| 45 | aghi %r15,160 |
| 46 | lmg %r2,%r5,32(%r15) |
| 47 | lg %r14,112(%r15) |
| 48 | br %r14 |
| 49 | |
| 50 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 51 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 52 | ENTRY(return_to_handler) |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 53 | stmg %r2,%r5,32(%r15) |
| 54 | lgr %r1,%r15 |
| 55 | aghi %r15,-160 |
| 56 | stg %r1,__SF_BACKCHAIN(%r15) |
| 57 | brasl %r14,ftrace_return_to_handler |
| 58 | aghi %r15,160 |
| 59 | lgr %r14,%r2 |
| 60 | lmg %r2,%r5,32(%r15) |
| 61 | br %r14 |
| 62 | |
| 63 | #endif |