aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/kernel/entry_32.S27
-rw-r--r--arch/x86/kernel/entry_64.S37
3 files changed, 65 insertions, 0 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fe361ae7ef2f..c742dfeb0dbe 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -23,6 +23,7 @@ config X86
23 select HAVE_OPROFILE 23 select HAVE_OPROFILE
24 select HAVE_KPROBES 24 select HAVE_KPROBES
25 select HAVE_KRETPROBES 25 select HAVE_KRETPROBES
26 select HAVE_FTRACE
26 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 27 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
27 select HAVE_ARCH_KGDB if !X86_VOYAGER 28 select HAVE_ARCH_KGDB if !X86_VOYAGER
28 29
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 2a609dc3271c..f47b9b5440d2 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -1109,6 +1109,33 @@ ENDPROC(xen_failsafe_callback)
1109 1109
1110#endif /* CONFIG_XEN */ 1110#endif /* CONFIG_XEN */
1111 1111
1112#ifdef CONFIG_FTRACE
1113ENTRY(mcount)
1114 cmpl $ftrace_stub, ftrace_trace_function
1115 jnz trace
1116
1117.globl ftrace_stub
1118ftrace_stub:
1119 ret
1120
1121 /* taken from glibc */
1122trace:
1123 pushl %eax
1124 pushl %ecx
1125 pushl %edx
1126 movl 0xc(%esp), %eax
1127 movl 0x4(%ebp), %edx
1128
1129 call *ftrace_trace_function
1130
1131 popl %edx
1132 popl %ecx
1133 popl %eax
1134
1135 jmp ftrace_stub
1136END(mcount)
1137#endif
1138
1112.section .rodata,"a" 1139.section .rodata,"a"
1113#include "syscall_table_32.S" 1140#include "syscall_table_32.S"
1114 1141
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 556a8df522a7..f046e0c64883 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -54,6 +54,43 @@
54 54
55 .code64 55 .code64
56 56
57#ifdef CONFIG_FTRACE
58ENTRY(mcount)
59 cmpq $ftrace_stub, ftrace_trace_function
60 jnz trace
61.globl ftrace_stub
62ftrace_stub:
63 retq
64
65trace:
66 /* taken from glibc */
67 subq $0x38, %rsp
68 movq %rax, (%rsp)
69 movq %rcx, 8(%rsp)
70 movq %rdx, 16(%rsp)
71 movq %rsi, 24(%rsp)
72 movq %rdi, 32(%rsp)
73 movq %r8, 40(%rsp)
74 movq %r9, 48(%rsp)
75
76 movq 0x38(%rsp), %rdi
77 movq 8(%rbp), %rsi
78
79 call *ftrace_trace_function
80
81 movq 48(%rsp), %r9
82 movq 40(%rsp), %r8
83 movq 32(%rsp), %rdi
84 movq 24(%rsp), %rsi
85 movq 16(%rsp), %rdx
86 movq 8(%rsp), %rcx
87 movq (%rsp), %rax
88 addq $0x38, %rsp
89
90 jmp ftrace_stub
91END(mcount)
92#endif
93
57#ifndef CONFIG_PREEMPT 94#ifndef CONFIG_PREEMPT
58#define retint_kernel retint_restore_args 95#define retint_kernel retint_restore_args
59#endif 96#endif