Heiko Carstens | 5d360a7 | 2008-12-25 13:38:56 +0100 | [diff] [blame] | 1 | /* |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 2 | * Copyright IBM Corp. 2008,2009 |
Heiko Carstens | 5d360a7 | 2008-12-25 13:38:56 +0100 | [diff] [blame] | 3 | * |
| 4 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, |
| 5 | * |
| 6 | */ |
| 7 | |
Heiko Carstens | cf08734 | 2009-03-18 13:27:34 +0100 | [diff] [blame] | 8 | #include <asm/asm-offsets.h> |
| 9 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 10 | .section .kprobes.text, "ax" |
| 11 | |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 12 | .globl ftrace_stub |
| 13 | ftrace_stub: |
| 14 | br %r14 |
| 15 | |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 16 | .globl _mcount |
Heiko Carstens | 5d360a7 | 2008-12-25 13:38:56 +0100 | [diff] [blame] | 17 | _mcount: |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 18 | #ifdef CONFIG_DYNAMIC_FTRACE |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 19 | br %r14 |
| 20 | |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 21 | .globl ftrace_caller |
| 22 | ftrace_caller: |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 23 | #endif |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 24 | stm %r2,%r5,16(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 25 | bras %r1,2f |
| 26 | 0: .long ftrace_trace_function |
| 27 | 1: .long function_trace_stop |
| 28 | 2: l %r2,1b-0b(%r1) |
| 29 | icm %r2,0xf,0(%r2) |
| 30 | jnz 3f |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 31 | st %r14,56(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 32 | lr %r0,%r15 |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 33 | ahi %r15,-96 |
| 34 | l %r3,100(%r15) |
| 35 | la %r2,0(%r14) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 36 | st %r0,__SF_BACKCHAIN(%r15) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 37 | la %r3,0(%r3) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 38 | l %r14,0b-0b(%r1) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 39 | l %r14,0(%r14) |
| 40 | basr %r14,%r14 |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 41 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
Martin Schwidefsky | 4cc9bed | 2011-01-05 12:48:11 +0100 | [diff] [blame] | 42 | l %r2,100(%r15) |
| 43 | l %r3,152(%r15) |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 44 | .globl ftrace_graph_caller |
| 45 | ftrace_graph_caller: |
Martin Schwidefsky | 4cc9bed | 2011-01-05 12:48:11 +0100 | [diff] [blame] | 46 | # The bras instruction gets runtime patched to call prepare_ftrace_return. |
| 47 | # See ftrace_enable_ftrace_graph_caller. The patched instruction is: |
| 48 | # bras %r14,prepare_ftrace_return |
| 49 | bras %r14,0f |
| 50 | 0: st %r2,100(%r15) |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 51 | #endif |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 52 | ahi %r15,96 |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 53 | l %r14,56(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 54 | 3: lm %r2,%r5,16(%r15) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 55 | br %r14 |
| 56 | |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 57 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 58 | |
| 59 | .globl return_to_handler |
| 60 | return_to_handler: |
| 61 | stm %r2,%r5,16(%r15) |
| 62 | st %r14,56(%r15) |
| 63 | lr %r0,%r15 |
| 64 | ahi %r15,-96 |
| 65 | st %r0,__SF_BACKCHAIN(%r15) |
| 66 | bras %r1,0f |
| 67 | .long ftrace_return_to_handler |
| 68 | 0: l %r2,0b-0b(%r1) |
| 69 | basr %r14,%r2 |
| 70 | lr %r14,%r2 |
| 71 | ahi %r15,96 |
| 72 | lm %r2,%r5,16(%r15) |
| 73 | br %r14 |
| 74 | |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 75 | #endif |