diff options
Diffstat (limited to 'arch/x86/kernel/entry_32.S')
-rw-r--r-- | arch/x86/kernel/entry_32.S | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index cfe28a715434..6bc07f0f1202 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/percpu.h> | 51 | #include <asm/percpu.h> |
52 | #include <asm/dwarf2.h> | 52 | #include <asm/dwarf2.h> |
53 | #include <asm/processor-flags.h> | 53 | #include <asm/processor-flags.h> |
54 | #include <asm/ftrace.h> | ||
54 | #include <asm/irq_vectors.h> | 55 | #include <asm/irq_vectors.h> |
55 | 56 | ||
56 | /* | 57 | /* |
@@ -1111,6 +1112,77 @@ ENDPROC(xen_failsafe_callback) | |||
1111 | 1112 | ||
1112 | #endif /* CONFIG_XEN */ | 1113 | #endif /* CONFIG_XEN */ |
1113 | 1114 | ||
1115 | #ifdef CONFIG_FTRACE | ||
1116 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
1117 | |||
1118 | ENTRY(mcount) | ||
1119 | pushl %eax | ||
1120 | pushl %ecx | ||
1121 | pushl %edx | ||
1122 | movl 0xc(%esp), %eax | ||
1123 | subl $MCOUNT_INSN_SIZE, %eax | ||
1124 | |||
1125 | .globl mcount_call | ||
1126 | mcount_call: | ||
1127 | call ftrace_stub | ||
1128 | |||
1129 | popl %edx | ||
1130 | popl %ecx | ||
1131 | popl %eax | ||
1132 | |||
1133 | ret | ||
1134 | END(mcount) | ||
1135 | |||
1136 | ENTRY(ftrace_caller) | ||
1137 | pushl %eax | ||
1138 | pushl %ecx | ||
1139 | pushl %edx | ||
1140 | movl 0xc(%esp), %eax | ||
1141 | movl 0x4(%ebp), %edx | ||
1142 | subl $MCOUNT_INSN_SIZE, %eax | ||
1143 | |||
1144 | .globl ftrace_call | ||
1145 | ftrace_call: | ||
1146 | call ftrace_stub | ||
1147 | |||
1148 | popl %edx | ||
1149 | popl %ecx | ||
1150 | popl %eax | ||
1151 | |||
1152 | .globl ftrace_stub | ||
1153 | ftrace_stub: | ||
1154 | ret | ||
1155 | END(ftrace_caller) | ||
1156 | |||
1157 | #else /* ! CONFIG_DYNAMIC_FTRACE */ | ||
1158 | |||
1159 | ENTRY(mcount) | ||
1160 | cmpl $ftrace_stub, ftrace_trace_function | ||
1161 | jnz trace | ||
1162 | .globl ftrace_stub | ||
1163 | ftrace_stub: | ||
1164 | ret | ||
1165 | |||
1166 | /* taken from glibc */ | ||
1167 | trace: | ||
1168 | pushl %eax | ||
1169 | pushl %ecx | ||
1170 | pushl %edx | ||
1171 | movl 0xc(%esp), %eax | ||
1172 | movl 0x4(%ebp), %edx | ||
1173 | subl $MCOUNT_INSN_SIZE, %eax | ||
1174 | |||
1175 | call *ftrace_trace_function | ||
1176 | |||
1177 | popl %edx | ||
1178 | popl %ecx | ||
1179 | popl %eax | ||
1180 | |||
1181 | jmp ftrace_stub | ||
1182 | END(mcount) | ||
1183 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
1184 | #endif /* CONFIG_FTRACE */ | ||
1185 | |||
1114 | .section .rodata,"a" | 1186 | .section .rodata,"a" |
1115 | #include "syscall_table_32.S" | 1187 | #include "syscall_table_32.S" |
1116 | 1188 | ||