9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@gmx.de
To: 9fans@9fans.net
Subject: Re: [9fans] acid question
Date: Sat, 17 Jul 2010 18:46:25 +0200	[thread overview]
Message-ID: <8272a8c4839aa6f5a1f1f318014e8bed@gmx.de> (raw)
In-Reply-To: <4C41D2A6.7080402@bouyapop.org>

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

defn call(addr)
{
	local opc;

	opc = *PC;
	bpset(*PC);
	*SP = *SP - 4;
	**SP = *PC;
	*PC = addr;
	cont();
	bpdel(*PC);
}

[-- Attachment #2: Type: message/rfc822, Size: 3537 bytes --]

From: Philippe Anel <xigh@bouyapop.org>
To: 9fans@9fans.net
Subject: Re: [9fans] acid question
Date: Sat, 17 Jul 2010 17:56:22 +0200
Message-ID: <4C41D2A6.7080402@bouyapop.org>



This one sounds like to work (except it does not save registers) ...

defn call(addr)
{
	local pco;

	// we need stack space, and thus process stopped.
	if status(pid) != "Stopped" then {
		print("Waiting...\n");
		stop(pid);
	}

	// Backup orginal instruction
	pco = fmt(*PC, bpfmt);

	// Put a temporary breakpoint
	**PC = bpinst;

	// update stack pointer
	*SP = *SP - 4;

	// make called function returning to this point
	**SP = *PC;

	// set PC to function to call
	*PC = addr;

	// do the call
	startstop(pid);

	// restore original instruction
	*PC = pco;
}

Phil;

  reply	other threads:[~2010-07-17 16:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-17  8:33 Skip Tavakkolian
2010-07-17  8:48 ` EBo
2010-07-17  9:19   ` Skip Tavakkolian
2010-07-17 12:15     ` EBo
2010-07-17 15:00 ` Philippe Anel
2010-07-17 15:56   ` Philippe Anel
2010-07-17 16:46     ` cinap_lenrek [this message]
2010-07-17 16:48     ` cinap_lenrek
2010-07-17 17:23     ` Skip Tavakkolian
2010-07-17 17:58       ` Philippe Anel
  -- strict thread matches above, loose matches on Subject: below --
2005-01-08  3:36 Tim Newsham
2005-01-08  5:41 ` Rob Pike
2005-01-08  6:34   ` Tim Newsham
2005-01-08 21:46 ` Tim Newsham

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=8272a8c4839aa6f5a1f1f318014e8bed@gmx.de \
    --to=cinap_lenrek@gmx.de \
    --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).