Skip to contentSkip to conversation

x86-32: micro-optimize mcount trampoline

PATCH New Jan Kiszka 1 participant 1 message Jan 10, 2008 x86

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 x86-32: micro-optimize mcount trampoline

Looking at the 64-bit variant and the implementation in glibc, I noticed that we can still save some cycles in current mcount_32. With this patch applied, the tracer still works and provides consistent output.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
---
 arch/x86/kernel/mcount_32.S |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
arch/x86/kernel/mcount_32.S +2 -7
Index: linux-2.6.24-rc6-xeno/arch/x86/kernel/mcount_32.S
===================================================================
@@ -9,17 +9,13 @@ mcount:
 	cmpl $0,ipipe_trace_enable
 	je out
 
-	pushl %ebp
-	movl %esp,%ebp
-
 	pushl %eax
 	pushl %ecx
 	pushl %edx
 
 	pushl $0		# no additional value (v)
-	movl (%ebp),%eax
-	movl 0x4(%ebp),%edx	# __CALLER_ADDR0
-	movl 0x4(%eax),%ecx	# __CALLER_ADDR1
+	movl 4(%ebp),%ecx	# __CALLER_ADDR1
+	movl 16(%esp),%edx	# __CALLER_ADDR0
 	movl $0,%eax		# IPIPE_TRACE_FUNC
 	call __ipipe_trace
 	popl %eax
@@ -27,6 +23,5 @@ mcount:
 	popl %edx
 	popl %ecx
 	popl %eax
-	popl %ebp
 out:
 	ret