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 c778e4fa55a2..95e6bbe3665e 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 "irq_vectors.h" | 55 | #include "irq_vectors.h" |
55 | 56 | ||
56 | /* | 57 | /* |
@@ -1110,6 +1111,77 @@ ENDPROC(xen_failsafe_callback) | |||
1110 | 1111 | ||
1111 | #endif /* CONFIG_XEN */ | 1112 | #endif /* CONFIG_XEN */ |
1112 | 1113 | ||
1114 | #ifdef CONFIG_FTRACE | ||
1115 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
1116 | |||
1117 | ENTRY(mcount) | ||
1118 | pushl %eax | ||
1119 | pushl %ecx | ||
1120 | pushl %edx | ||
1121 | movl 0xc(%esp), %eax | ||
1122 | subl $MCOUNT_INSN_SIZE, %eax | ||
1123 | |||
1124 | .globl mcount_call | ||
1125 | mcount_call: | ||
1126 | call ftrace_stub | ||
1127 | |||
1128 | popl %edx | ||
1129 | popl %ecx | ||
1130 | popl %eax | ||
1131 | |||
1132 | ret | ||
1133 | END(mcount) | ||
1134 | |||
1135 | ENTRY(ftrace_caller) | ||
1136 | pushl %eax | ||
1137 | pushl %ecx | ||
1138 | pushl %edx | ||
1139 | movl 0xc(%esp), %eax | ||
1140 | movl 0x4(%ebp), %edx | ||
1141 | subl $MCOUNT_INSN_SIZE, %eax | ||
1142 | |||
1143 | .globl ftrace_call | ||
1144 | ftrace_call: | ||
1145 | call ftrace_stub | ||
1146 | |||
1147 | popl %edx | ||
1148 | popl %ecx | ||
1149 | popl %eax | ||
1150 | |||
1151 | .globl ftrace_stub | ||
1152 | ftrace_stub: | ||
1153 | ret | ||
1154 | END(ftrace_caller) | ||
1155 | |||
1156 | #else /* ! CONFIG_DYNAMIC_FTRACE */ | ||
1157 | |||
1158 | ENTRY(mcount) | ||
1159 | cmpl $ftrace_stub, ftrace_trace_function | ||
1160 | jnz trace | ||
1161 | .globl ftrace_stub | ||
1162 | ftrace_stub: | ||
1163 | ret | ||
1164 | |||
1165 | /* taken from glibc */ | ||
1166 | trace: | ||
1167 | pushl %eax | ||
1168 | pushl %ecx | ||
1169 | pushl %edx | ||
1170 | movl 0xc(%esp), %eax | ||
1171 | movl 0x4(%ebp), %edx | ||
1172 | subl $MCOUNT_INSN_SIZE, %eax | ||
1173 | |||
1174 | call *ftrace_trace_function | ||
1175 | |||
1176 | popl %edx | ||
1177 | popl %ecx | ||
1178 | popl %eax | ||
1179 | |||
1180 | jmp ftrace_stub | ||
1181 | END(mcount) | ||
1182 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
1183 | #endif /* CONFIG_FTRACE */ | ||
1184 | |||
1113 | .section .rodata,"a" | 1185 | .section .rodata,"a" |
1114 | #include "syscall_table_32.S" | 1186 | #include "syscall_table_32.S" |
1115 | 1187 | ||