From: Tsutomu OWA <tsutomu.owa@toshiba.co.jp>
To: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, tglx@linutronix.de
Subject: Re: [patch 1/5] powerpc 2.6.21-rt1: add mcount() and _mcount()
Date: Mon, 14 May 2007 17:15:10 +0900 [thread overview]
Message-ID: <yyir6pj95yp.wl@toshiba.co.jp> (raw)
In-Reply-To: <yyisl9z97hg.wl@toshiba.co.jp>
add mcount() and _mcount() for latency trace support.
Signed-off-by: Tsutomu OWA <tsutomu.owa@toshiba.co.jp>
-- owa
diff -rup linux-2.6.21-rt1/arch/powerpc/kernel/entry_64.S rt/arch/powerpc/kernel/entry_64.S
--- linux-2.6.21-rt1/arch/powerpc/kernel/entry_64.S 2007-05-07 14:08:12.000000000 +0900
+++ rt/arch/powerpc/kernel/entry_64.S 2007-05-08 18:54:07.000000000 +0900
@@ -832,3 +832,63 @@ _GLOBAL(enter_prom)
ld r0,16(r1)
mtlr r0
blr
+
+#ifdef CONFIG_MCOUNT
+/*
+ * code almost taken from entry_32.S
+ */
+#define MCOUNT_FRAME_SIZE 32
+_GLOBAL(mcount)
+ stdu r1,-MCOUNT_FRAME_SIZE(r1)
+ mflr r3
+
+ LOAD_REG_ADDR(r5,mcount_enabled)
+ lwz r5,0(r5)
+ std r3,MCOUNT_FRAME_SIZE+16(r1)
+ cmpwi r5,0
+ beq 1f
+
+ /* r3 contains lr (eip), put parent lr (parent_eip) in r4 */
+ ld r4,MCOUNT_FRAME_SIZE(r1)
+ ld r4,16(r4)
+ bl .__trace
+ nop
+1:
+ ld r0,MCOUNT_FRAME_SIZE+16(r1)
+ mtlr r0
+ addi r1,r1,MCOUNT_FRAME_SIZE
+ blr
+
+/*
+ * Based on glibc-2.4/sysdeps/powerpc/powerpc64/ppc-mcount.S
+ *
+ * We don't need to save the parameter-passing registers as gcc takes
+ * care of that for us. Thus this function looks fairly normal.
+ * In fact, the generic code would work for us.
+ */
+_GLOBAL(_mcount)
+ /* return if we're in real mode. */
+ mfmsr r3
+ andi. r0,r3,MSR_IR|MSR_DR /* see if relocation is on? */
+ beqlr /* if not, do nothing. */
+ /* we're in translation mode. keep going. */
+ mflr r3
+ ld r11,0(r1) /* load back chain ptr */
+ stdu r1,-STACK_FRAME_OVERHEAD(r1)
+ std r3,STACK_FRAME_OVERHEAD+16(r1)
+ ld r4,16(r11) /* LR in back chain */
+ LOAD_REG_ADDR(r5,mcount_enabled)
+ lwz r5,0(r5)
+ cmpwi r5,0 /* see if mcount_enabled? */
+ beq 1f /* if disabled, then skip */
+
+ /* r3 contains lr (eip), put parent lr (parent_eip) in r4 */
+ bl .__trace
+ nop
+1:
+ ld r0,STACK_FRAME_OVERHEAD+16(r1) /* restore saved LR */
+ mtlr r0
+ addi r1,r1,STACK_FRAME_OVERHEAD
+ blr
+
+#endif /* CONFIG_MCOUNT */
next prev parent reply other threads:[~2007-05-14 8:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 7:42 [patch 0/5] powerpc 2.6.21-rt1] latency trace support for powerpc Tsutomu OWA
2007-05-14 8:15 ` Tsutomu OWA [this message]
2007-05-14 8:16 ` [patch 2/5] powerpc 2.6.21-rt1: dummy functions and export _mcount to compile Tsutomu OWA
2007-05-14 8:17 ` [patch 3/5] powerpc 2.6.21-rt1: mark raw_local_irq_restore() and timebase_read() as notrace Tsutomu OWA
2007-05-14 8:19 ` [patch 4/5] powerpc 2.6.21-rt1: rename mcount variable in xmon to xmon_mcount Tsutomu OWA
2007-05-14 8:23 ` [patch 5/5] powerpc 2.6.21-rt1] fix clocksource_timebase.shift value Tsutomu OWA
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=yyir6pj95yp.wl@toshiba.co.jp \
--to=tsutomu.owa@toshiba.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox