diff options
Diffstat (limited to 'arch/powerpc/kernel/misc.S')
-rw-r--r-- | arch/powerpc/kernel/misc.S | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index 2d29752cbe16..b485a87c94e1 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -127,3 +127,31 @@ _GLOBAL(__setup_cpu_power7) | |||
127 | _GLOBAL(__restore_cpu_power7) | 127 | _GLOBAL(__restore_cpu_power7) |
128 | /* place holder */ | 128 | /* place holder */ |
129 | blr | 129 | blr |
130 | |||
131 | #ifdef CONFIG_EVENT_TRACING | ||
132 | /* | ||
133 | * Get a minimal set of registers for our caller's nth caller. | ||
134 | * r3 = regs pointer, r5 = n. | ||
135 | * | ||
136 | * We only get R1 (stack pointer), NIP (next instruction pointer) | ||
137 | * and LR (link register). These are all we can get in the | ||
138 | * general case without doing complicated stack unwinding, but | ||
139 | * fortunately they are enough to do a stack backtrace, which | ||
140 | * is all we need them for. | ||
141 | */ | ||
142 | _GLOBAL(perf_arch_fetch_caller_regs) | ||
143 | mr r6,r1 | ||
144 | cmpwi r5,0 | ||
145 | mflr r4 | ||
146 | ble 2f | ||
147 | mtctr r5 | ||
148 | 1: PPC_LL r6,0(r6) | ||
149 | bdnz 1b | ||
150 | PPC_LL r4,PPC_LR_STKOFF(r6) | ||
151 | 2: PPC_LL r7,0(r6) | ||
152 | PPC_LL r7,PPC_LR_STKOFF(r7) | ||
153 | PPC_STL r6,GPR1-STACK_FRAME_OVERHEAD(r3) | ||
154 | PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3) | ||
155 | PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3) | ||
156 | blr | ||
157 | #endif /* CONFIG_EVENT_TRACING */ | ||