diff options
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 556a8df522a7..fe25e5febca3 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -54,6 +54,108 @@ | |||
54 | 54 | ||
55 | .code64 | 55 | .code64 |
56 | 56 | ||
57 | #ifdef CONFIG_FTRACE | ||
58 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
59 | ENTRY(mcount) | ||
60 | |||
61 | subq $0x38, %rsp | ||
62 | movq %rax, (%rsp) | ||
63 | movq %rcx, 8(%rsp) | ||
64 | movq %rdx, 16(%rsp) | ||
65 | movq %rsi, 24(%rsp) | ||
66 | movq %rdi, 32(%rsp) | ||
67 | movq %r8, 40(%rsp) | ||
68 | movq %r9, 48(%rsp) | ||
69 | |||
70 | movq 0x38(%rsp), %rdi | ||
71 | |||
72 | .globl mcount_call | ||
73 | mcount_call: | ||
74 | call ftrace_stub | ||
75 | |||
76 | movq 48(%rsp), %r9 | ||
77 | movq 40(%rsp), %r8 | ||
78 | movq 32(%rsp), %rdi | ||
79 | movq 24(%rsp), %rsi | ||
80 | movq 16(%rsp), %rdx | ||
81 | movq 8(%rsp), %rcx | ||
82 | movq (%rsp), %rax | ||
83 | addq $0x38, %rsp | ||
84 | |||
85 | retq | ||
86 | END(mcount) | ||
87 | |||
88 | ENTRY(ftrace_caller) | ||
89 | |||
90 | /* taken from glibc */ | ||
91 | subq $0x38, %rsp | ||
92 | movq %rax, (%rsp) | ||
93 | movq %rcx, 8(%rsp) | ||
94 | movq %rdx, 16(%rsp) | ||
95 | movq %rsi, 24(%rsp) | ||
96 | movq %rdi, 32(%rsp) | ||
97 | movq %r8, 40(%rsp) | ||
98 | movq %r9, 48(%rsp) | ||
99 | |||
100 | movq 0x38(%rsp), %rdi | ||
101 | movq 8(%rbp), %rsi | ||
102 | |||
103 | .globl ftrace_call | ||
104 | ftrace_call: | ||
105 | call ftrace_stub | ||
106 | |||
107 | movq 48(%rsp), %r9 | ||
108 | movq 40(%rsp), %r8 | ||
109 | movq 32(%rsp), %rdi | ||
110 | movq 24(%rsp), %rsi | ||
111 | movq 16(%rsp), %rdx | ||
112 | movq 8(%rsp), %rcx | ||
113 | movq (%rsp), %rax | ||
114 | addq $0x38, %rsp | ||
115 | |||
116 | .globl ftrace_stub | ||
117 | ftrace_stub: | ||
118 | retq | ||
119 | END(ftrace_caller) | ||
120 | |||
121 | #else /* ! CONFIG_DYNAMIC_FTRACE */ | ||
122 | ENTRY(mcount) | ||
123 | cmpq $ftrace_stub, ftrace_trace_function | ||
124 | jnz trace | ||
125 | .globl ftrace_stub | ||
126 | ftrace_stub: | ||
127 | retq | ||
128 | |||
129 | trace: | ||
130 | /* taken from glibc */ | ||
131 | subq $0x38, %rsp | ||
132 | movq %rax, (%rsp) | ||
133 | movq %rcx, 8(%rsp) | ||
134 | movq %rdx, 16(%rsp) | ||
135 | movq %rsi, 24(%rsp) | ||
136 | movq %rdi, 32(%rsp) | ||
137 | movq %r8, 40(%rsp) | ||
138 | movq %r9, 48(%rsp) | ||
139 | |||
140 | movq 0x38(%rsp), %rdi | ||
141 | movq 8(%rbp), %rsi | ||
142 | |||
143 | call *ftrace_trace_function | ||
144 | |||
145 | movq 48(%rsp), %r9 | ||
146 | movq 40(%rsp), %r8 | ||
147 | movq 32(%rsp), %rdi | ||
148 | movq 24(%rsp), %rsi | ||
149 | movq 16(%rsp), %rdx | ||
150 | movq 8(%rsp), %rcx | ||
151 | movq (%rsp), %rax | ||
152 | addq $0x38, %rsp | ||
153 | |||
154 | jmp ftrace_stub | ||
155 | END(mcount) | ||
156 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
157 | #endif /* CONFIG_FTRACE */ | ||
158 | |||
57 | #ifndef CONFIG_PREEMPT | 159 | #ifndef CONFIG_PREEMPT |
58 | #define retint_kernel retint_restore_args | 160 | #define retint_kernel retint_restore_args |
59 | #endif | 161 | #endif |