aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_32.S
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-05-14 23:49:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 16:43:11 -0400
commit4e491d14f2506b218d678935c25a7027b79178b1 (patch)
treec61c3ca40fe85f8556c579e50e0cb563ffcd06da /arch/powerpc/kernel/entry_32.S
parente0eca07badc023a675a61906020b397da20f07c3 (diff)
ftrace: support for PowerPC
This patch adds full support for ftrace for PowerPC (both 64 and 32 bit). This includes dynamic tracing and function filtering. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/powerpc/kernel/entry_32.S')
-rw-r--r--arch/powerpc/kernel/entry_32.S130
1 files changed, 130 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 0c8614d9875c..0e6221889ca9 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -1035,3 +1035,133 @@ machine_check_in_rtas:
1035 /* XXX load up BATs and panic */ 1035 /* XXX load up BATs and panic */
1036 1036
1037#endif /* CONFIG_PPC_RTAS */ 1037#endif /* CONFIG_PPC_RTAS */
1038
1039#ifdef CONFIG_FTRACE
1040#ifdef CONFIG_DYNAMIC_FTRACE
1041_GLOBAL(mcount)
1042_GLOBAL(_mcount)
1043 stwu r1,-48(r1)
1044 stw r3, 12(r1)
1045 stw r4, 16(r1)
1046 stw r5, 20(r1)
1047 stw r6, 24(r1)
1048 mflr r3
1049 stw r7, 28(r1)
1050 mfcr r5
1051 stw r8, 32(r1)
1052 stw r9, 36(r1)
1053 stw r10,40(r1)
1054 stw r3, 44(r1)
1055 stw r5, 8(r1)
1056 .globl mcount_call
1057mcount_call:
1058 bl ftrace_stub
1059 nop
1060 lwz r6, 8(r1)
1061 lwz r0, 44(r1)
1062 lwz r3, 12(r1)
1063 mtctr r0
1064 lwz r4, 16(r1)
1065 mtcr r6
1066 lwz r5, 20(r1)
1067 lwz r6, 24(r1)
1068 lwz r0, 52(r1)
1069 lwz r7, 28(r1)
1070 lwz r8, 32(r1)
1071 mtlr r0
1072 lwz r9, 36(r1)
1073 lwz r10,40(r1)
1074 addi r1, r1, 48
1075 bctr
1076
1077_GLOBAL(ftrace_caller)
1078 /* Based off of objdump optput from glibc */
1079 stwu r1,-48(r1)
1080 stw r3, 12(r1)
1081 stw r4, 16(r1)
1082 stw r5, 20(r1)
1083 stw r6, 24(r1)
1084 mflr r3
1085 lwz r4, 52(r1)
1086 mfcr r5
1087 stw r7, 28(r1)
1088 stw r8, 32(r1)
1089 stw r9, 36(r1)
1090 stw r10,40(r1)
1091 stw r3, 44(r1)
1092 stw r5, 8(r1)
1093.globl ftrace_call
1094ftrace_call:
1095 bl ftrace_stub
1096 nop
1097 lwz r6, 8(r1)
1098 lwz r0, 44(r1)
1099 lwz r3, 12(r1)
1100 mtctr r0
1101 lwz r4, 16(r1)
1102 mtcr r6
1103 lwz r5, 20(r1)
1104 lwz r6, 24(r1)
1105 lwz r0, 52(r1)
1106 lwz r7, 28(r1)
1107 lwz r8, 32(r1)
1108 mtlr r0
1109 lwz r9, 36(r1)
1110 lwz r10,40(r1)
1111 addi r1, r1, 48
1112 bctr
1113#else
1114_GLOBAL(mcount)
1115_GLOBAL(_mcount)
1116 stwu r1,-48(r1)
1117 stw r3, 12(r1)
1118 stw r4, 16(r1)
1119 stw r5, 20(r1)
1120 stw r6, 24(r1)
1121 mflr r3
1122 lwz r4, 52(r1)
1123 mfcr r5
1124 stw r7, 28(r1)
1125 stw r8, 32(r1)
1126 stw r9, 36(r1)
1127 stw r10,40(r1)
1128 stw r3, 44(r1)
1129 stw r5, 8(r1)
1130
1131 LOAD_REG_ADDR(r5, ftrace_trace_function)
1132#if 0
1133 mtctr r3
1134 mr r1, r5
1135 bctrl
1136#endif
1137 lwz r5,0(r5)
1138#if 1
1139 mtctr r5
1140 bctrl
1141#else
1142 bl ftrace_stub
1143#endif
1144 nop
1145
1146 lwz r6, 8(r1)
1147 lwz r0, 44(r1)
1148 lwz r3, 12(r1)
1149 mtctr r0
1150 lwz r4, 16(r1)
1151 mtcr r6
1152 lwz r5, 20(r1)
1153 lwz r6, 24(r1)
1154 lwz r0, 52(r1)
1155 lwz r7, 28(r1)
1156 lwz r8, 32(r1)
1157 mtlr r0
1158 lwz r9, 36(r1)
1159 lwz r10,40(r1)
1160 addi r1, r1, 48
1161 bctr
1162#endif
1163
1164_GLOBAL(ftrace_stub)
1165 blr
1166
1167#endif /* CONFIG_MCOUNT */