This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]