Re: [Linux-ia64] use of setcontext()/getcontext()

From: David Mosberger <davidm_at_hpl.hp.com>
Date: 2001-09-28 03:38:34
>>>>> On Thu, 27 Sep 2001 09:31:25 +0200 (CEST), stefan <stefan@lkcc.org> said:

  stefan> Some more details about the pseudo code:

  stefan> [snip]

  stefan> Does this explain it better ?

Yes, I understand now what you're trying to do.

  stefan> I guess I can't just read r9 for the above purpose ?

I suppose you could.  Since the solution will be platform-dependent no
matter how you slice it, you might just as well rely on the ia64 linux
specific behavior of getcontext().  Below is a code fragment that shows
how swapcontext() can be implemented on ia64 linux.  You can use the
same approach for your case.

	--david

struct rv
  {
    long retval;
    long first_return;
  };

int
swapcontext (ucontext_t *oucp, const ucontext_t *ucp)
{
  struct rv rv = getcontext (oucp);
  if (rv.first_return)
    setcontext (ucp);
  return 0;
}
Received on Thu Sep 27 10:38:43 2001

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:05 EST