This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC] Proposal of marker implementation
- From: Chuck Ebbert <76306 dot 1226 at compuserve dot com>
- To: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- Cc: Hideo Aoki <haoki at redhat dot com>, Satoshi Oshima <soshima at redhat dot com>, Yumiko Sugita <yumiko dot sugita dot yf at hitachi dot com>, systemtap <systemtap at sourceware dot org>
- Date: Thu, 10 Aug 2006 13:39:18 -0400
- Subject: [RFC] Proposal of marker implementation
In-Reply-To: <44D97397.2080005@hitachi.com>
On Wed, 09 Aug 2006 14:33:11 +0900, Masami Hiramatsu wrote:
> I'd like to suggest my marker idea which I spoke in OLS.
> My idea is based on the "section" of elf binary and the djprobe.
>
> Here is the concept code on i386 architecture.
> ---
> #define __MARKER_NOP(name) \
> asm volatile ("771:\n\t" ASM_NOP6 "\n772:\n" \
> ".section .markers,\"a\"\n" \
> " .align 4\n" \
> " .long 771b\n" /* label */ \
> " .byte 772b-771b\n" /* length */ \
> " .string \"" #name "\"\n" /* name */ \
> ".previous\n" \
> ::: "memory")
Why do you clobber memory?
If you explicitly clobber "eax", "ecx", "edx" you can safely change your
no-op into a C function call, assuming no problems with preempt and/or
SMP synchronization.
Even if you have to use a 1-byte no-op and replace it with Int3 there
could be some advantages to your approach:
a. No worry about caller-saved regs if the marker clobbers them.
b. Don't need to save the replaced byte because it's always 0x90.
c. No need to execute the replaced insn out-of-line since it's
a no-op.
d. Solves the problem of "first instruction in a function is
part of a loop."
--
Chuck