All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: adeos-main <adeos-main@gna.org>
Cc: Philippe Gerum <rpm@xenomai.org>
Subject: [Adeos-main] [PATCH] x86-32: micro-optimize mcount trampoline
Date: Thu, 10 Jan 2008 17:31:40 +0100	[thread overview]
Message-ID: <4786486C.1020907@domain.hid> (raw)

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

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

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


[-- Attachment #2: optimize-x86-32-mcount.patch --]
[-- Type: text/x-patch, Size: 842 bytes --]

---
 arch/x86/kernel/mcount_32.S |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: linux-2.6.24-rc6-xeno/arch/x86/kernel/mcount_32.S
===================================================================
--- linux-2.6.24-rc6-xeno.orig/arch/x86/kernel/mcount_32.S
+++ 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


                 reply	other threads:[~2008-01-10 16:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4786486C.1020907@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.org \
    --cc=rpm@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.