diff options
-rw-r--r-- | arch/powerpc/include/asm/asm-compat.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/misc.S | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h index c1b475a941eb..a9b91ed3d4b9 100644 --- a/arch/powerpc/include/asm/asm-compat.h +++ b/arch/powerpc/include/asm/asm-compat.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh) | 28 | #define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh) |
29 | #define PPC_STLCX stringify_in_c(stdcx.) | 29 | #define PPC_STLCX stringify_in_c(stdcx.) |
30 | #define PPC_CNTLZL stringify_in_c(cntlzd) | 30 | #define PPC_CNTLZL stringify_in_c(cntlzd) |
31 | #define PPC_LR_STKOFF 16 | ||
31 | 32 | ||
32 | /* Move to CR, single-entry optimized version. Only available | 33 | /* Move to CR, single-entry optimized version. Only available |
33 | * on POWER4 and later. | 34 | * on POWER4 and later. |
@@ -51,6 +52,7 @@ | |||
51 | #define PPC_STLCX stringify_in_c(stwcx.) | 52 | #define PPC_STLCX stringify_in_c(stwcx.) |
52 | #define PPC_CNTLZL stringify_in_c(cntlzw) | 53 | #define PPC_CNTLZL stringify_in_c(cntlzw) |
53 | #define PPC_MTOCRF stringify_in_c(mtcrf) | 54 | #define PPC_MTOCRF stringify_in_c(mtcrf) |
55 | #define PPC_LR_STKOFF 4 | ||
54 | 56 | ||
55 | #endif | 57 | #endif |
56 | 58 | ||
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 */ | ||