9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Nick Owens <mischief@9.offblast.org>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] 8l -e
Date: Tue, 27 May 2014 14:30:18 -0700	[thread overview]
Message-ID: <20140527213018.GQ3763@iota.offblast.org> (raw)
In-Reply-To: <0e05f8946ce2cff4a4ad7d2e044b984d@ladd.quanstro.net>

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

On Tue, May 27, 2014 at 04:16:24PM -0400, erik quanstrom wrote:
> > you can see there is a JMP over _tracein and a RET before _traceout.
> > what gives?
> 
> ah, that's the magic!  the idea is to be able to enable and disable these tracepoints
> at runtime in a multiprocessor environment without any locking.
> 
> - erik
> 

ok. i'm beginning to understand better. is there a specific use case,
such as the kernel or userland?

i didn't see anything like a tool that could poke nops into the right
places. i started to write an acid function to put the nops in one
 named function, and then i realized that the ret can appear several
 times in one function and i would need to search for and patch them
 out. but only the *first* ret, not second, e.g.:

 setvar+0x3a 0x0000adf5	RET			<--- should be NOP
 setvar+0x3b 0x0000adf6	CALL	_traceout(SB)
 setvar+0x40 0x0000adfb	RET			<--- should not be NOP

 i was able to patch the JMP, and the RET but only in the case where it
 appears at the bottom of a function.

defn traceon(fn){
	bound = fnbound(fn);

	// nop first jmp
	*(bound[0]) = 0x90\b;
	*(bound[0]+1) = 0x90\b;

	// and the ret
	// XXX should search for ret
	*(bound[1]-7) = 0x90\b;
}


maybe these were not the droids i was looking for.
my real goal is to make timing statistics for function calls in a program.
perhaps this goal is better fulfilled simply by prof!


[-- Attachment #2: Type: application/pgp-signature, Size: 851 bytes --]

  reply	other threads:[~2014-05-27 21:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 20:10 Nick Owens
2014-05-27 20:16 ` erik quanstrom
2014-05-27 21:30   ` Nick Owens [this message]
2014-05-27 21:33     ` erik quanstrom
2015-07-08  2:43       ` michaelian ennis
2015-07-08  2:44         ` michaelian ennis

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=20140527213018.GQ3763@iota.offblast.org \
    --to=mischief@9.offblast.org \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).