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 | |
| 21 | .data |
| 22 | .globl ftrace_dyn_func |
| 23 | ftrace_dyn_func: |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 24 | .long ftrace_stub |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 25 | .previous |
| 26 | |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 27 | .globl ftrace_caller |
| 28 | ftrace_caller: |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 29 | #endif |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 30 | stm %r2,%r5,16(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 31 | bras %r1,2f |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 32 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 33 | 0: .long ftrace_dyn_func |
| 34 | #else |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 35 | 0: .long ftrace_trace_function |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 36 | #endif |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 37 | 1: .long function_trace_stop |
| 38 | 2: l %r2,1b-0b(%r1) |
| 39 | icm %r2,0xf,0(%r2) |
| 40 | jnz 3f |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 41 | st %r14,56(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 42 | lr %r0,%r15 |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 43 | ahi %r15,-96 |
| 44 | l %r3,100(%r15) |
| 45 | la %r2,0(%r14) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 46 | st %r0,__SF_BACKCHAIN(%r15) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 47 | la %r3,0(%r3) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 48 | l %r14,0b-0b(%r1) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 49 | l %r14,0(%r14) |
| 50 | basr %r14,%r14 |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 51 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 52 | #ifdef CONFIG_DYNAMIC_FTRACE |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 53 | .globl ftrace_graph_caller |
| 54 | ftrace_graph_caller: |
| 55 | # This unconditional branch gets runtime patched. Change only if |
| 56 | # you know what you are doing. See ftrace_enable_graph_caller(). |
| 57 | j 1f |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 58 | #endif |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 59 | bras %r1,0f |
| 60 | .long prepare_ftrace_return |
| 61 | 0: l %r2,152(%r15) |
| 62 | l %r4,0(%r1) |
| 63 | l %r3,100(%r15) |
| 64 | basr %r14,%r4 |
| 65 | st %r2,100(%r15) |
| 66 | 1: |
| 67 | #endif |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 68 | ahi %r15,96 |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 69 | l %r14,56(%r15) |
Heiko Carstens | 8b4488f | 2009-06-12 10:26:45 +0200 | [diff] [blame] | 70 | 3: lm %r2,%r5,16(%r15) |
Heiko Carstens | dfd9f7a | 2009-06-12 10:26:44 +0200 | [diff] [blame] | 71 | br %r14 |
| 72 | |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 73 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 74 | |
| 75 | .globl return_to_handler |
| 76 | return_to_handler: |
| 77 | stm %r2,%r5,16(%r15) |
| 78 | st %r14,56(%r15) |
| 79 | lr %r0,%r15 |
| 80 | ahi %r15,-96 |
| 81 | st %r0,__SF_BACKCHAIN(%r15) |
| 82 | bras %r1,0f |
| 83 | .long ftrace_return_to_handler |
| 84 | 0: l %r2,0b-0b(%r1) |
| 85 | basr %r14,%r2 |
| 86 | lr %r14,%r2 |
| 87 | ahi %r15,96 |
| 88 | lm %r2,%r5,16(%r15) |
| 89 | br %r14 |
| 90 | |
Martin Schwidefsky | 6ac2a4d | 2009-09-11 10:28:33 +0200 | [diff] [blame] | 91 | #endif |