Bladeren bron

ftrace/x86: Have save_mcount_regs store RIP in %rdi for first parameter

Instead of having save_mcount_regs store the RIP in %rdx as a temp register
to place it in the proper location of the pt_regs on the stack. Use the
%rdi register as the temp register. This lets us remove the extra store
in the ftrace_caller_setup macro.

Link: http://lkml.kernel.org/r/CA+55aFwF+qCGSKdGaEgW4p6N65GZ5_XTV=1NbtWDvxnd5yYLiw@mail.gmail.com
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1411262304010.3961@nanos

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt (Red Hat) 10 jaren geleden
bovenliggende
commit
094dfc5451
1 gewijzigde bestanden met toevoegingen van 3 en 4 verwijderingen
  1. 3 4
      arch/x86/kernel/mcount_64.S

+ 3 - 4
arch/x86/kernel/mcount_64.S

@@ -51,8 +51,8 @@
 	movq %r8, R8(%rsp)
 	movq %r8, R8(%rsp)
 	movq %r9, R9(%rsp)
 	movq %r9, R9(%rsp)
 	 /* Move RIP to its proper location */
 	 /* Move RIP to its proper location */
-	movq SS+8(%rsp), %rdx
-	movq %rdx, RIP(%rsp)
+	movq SS+8(%rsp), %rdi
+	movq %rdi, RIP(%rsp)
 	.endm
 	.endm
 
 
 .macro restore_mcount_regs skip=0
 .macro restore_mcount_regs skip=0
@@ -75,8 +75,7 @@ GLOBAL(\trace_label)
 	/* Load the ftrace_ops into the 3rd parameter */
 	/* Load the ftrace_ops into the 3rd parameter */
 	movq function_trace_op(%rip), %rdx
 	movq function_trace_op(%rip), %rdx
 
 
-	/* Load ip into the first parameter */
-	movq RIP(%rsp), %rdi
+	/* %rdi already has %rip from the save_mcount_regs macro */
 	subq $MCOUNT_INSN_SIZE, %rdi
 	subq $MCOUNT_INSN_SIZE, %rdi
 	/* Load the parent_ip into the second parameter */
 	/* Load the parent_ip into the second parameter */
 #ifdef CC_USING_FENTRY
 #ifdef CC_USING_FENTRY