Skip to contentSkip to conversation

x86: entry_64 - introduce FTRACE_ frame macro v2

PATCH Applied Cyrill Gorcunov 2 participants 2 messages Dec 12, 2008 – Dec 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: entry_64 - introduce FTRACE_ frame macro v2

Impact: clean up

Itroduce FTRACE_SAVE/RESTORE_FRAME which allow us to save a number of lines on source level.

Also fix a comment in ftrace.h.
---

Didn't add Steve's Ack since it's a new version

 arch/x86/include/asm/ftrace.h |   29 ++++++++++++++++++++-
 arch/x86/kernel/entry_64.S    |   57 +++++-------------------------------------
 2 files changed, 35 insertions(+), 51 deletions(-)
arch/x86/include/asm/ftrace.h +28 -1
Index: linux-2.6.git/arch/x86/include/asm/ftrace.h
===================================================================
@@ -1,6 +1,33 @@
 #ifndef _ASM_X86_FTRACE_H
 #define _ASM_X86_FTRACE_H
 
+#ifdef __ASSEMBLY__
+
+	.macro FTRACE_SAVE_FRAME
+	/* taken from glibc */
+	subq $0x38, %rsp
+	movq %rax, (%rsp)
+	movq %rcx, 8(%rsp)
+	movq %rdx, 16(%rsp)
+	movq %rsi, 24(%rsp)
+	movq %rdi, 32(%rsp)
+	movq %r8, 40(%rsp)
+	movq %r9, 48(%rsp)
+	.endm
+
+	.macro FTRACE_RESTORE_FRAME
+	movq 48(%rsp), %r9
+	movq 40(%rsp), %r8
+	movq 32(%rsp), %rdi
+	movq 24(%rsp), %rsi
+	movq 16(%rsp), %rdx
+	movq 8(%rsp), %rcx
+	movq (%rsp), %rax
+	addq $0x38, %rsp
+	.endm
+
+#endif
+
 #ifdef CONFIG_FUNCTION_TRACER
 #define MCOUNT_ADDR		((long)(mcount))
 #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */
@@ -46,7 +73,7 @@ struct ftrace_ret_stack {
 /*
  * Primary handler of a function return.
  * It relays on ftrace_return_to_handler.
- * Defined in entry32.S
+ * Defined in entry_32/64.S
  */
 extern void return_to_handler(void);
 
arch/x86/kernel/entry_64.S +7 -50

93 lines not on this page · raw message

Applied
#1 lore raw
Quoted 5 lines · Cyrill Gorcunov

Impact: clean up

Itroduce FTRACE_SAVE/RESTORE_FRAME which allow us to save a number of lines on source level.

Quoted 8 lines

Also fix a comment in ftrace.h.
---

Didn't add Steve's Ack since it's a new version

 arch/x86/include/asm/ftrace.h |   29 ++++++++++++++++++++-
 arch/x86/kernel/entry_64.S    |   57 +++++-------------------------------------
 2 files changed, 35 insertions(+), 51 deletions(-)

applied to tip/tracing/ftrace, thanks Cyrill!

i renamed it from FTRACE_* to MCOUNT_* - since that's where these frame details come from - these are stubs around GCC generated mcount calls.

Ingo