From: stefan <stefan@lkcc.org>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] use of setcontext()/getcontext()
Date: Tue, 25 Sep 2001 19:35:12 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590698805251@msgid-missing> (raw)
Hello list,
I wonder if the above function set can be used to implement something
like what is used to work on other types of machines with
setjmp()/longjmp(). I would like to continue a program at a certain point
of execution with a saved environment. I achieved this by now by the
following algorithm and want to ask if there is any better way.
static __cont_done = 0;
make_continuation {
__cont_done = 0
getcontext(ctx)
if (__cont_done) goto __continuation
save_both_stacks() // register and normal stack in heap
return
__continuation:
return
}
run_continuation {
restore_both_stacks() // register and normal stack from heap
__cont_done = 1
setcontext(ctx)
}
I do not like the static __cont_done in the piece of code. But I do not
know how to determine if the instruction behind the getcontext() call is
due to a normal call to make_continuation() or due to the setcontext() of
run_continuation(). The setjmp() does return something appropiate but I do
not know how to do it with setcontext()/getcontext().
Thanks in advance,
stefan@lkcc.org
next reply other threads:[~2001-09-25 19:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-25 19:35 stefan [this message]
2001-09-26 22:24 ` [Linux-ia64] use of setcontext()/getcontext() David Mosberger
2001-09-27 7:31 ` stefan
2001-09-27 17:38 ` David Mosberger
2001-09-29 16:53 ` stefan
2001-10-09 6:01 ` stefan
2001-10-10 22:17 ` David Mosberger
2001-10-11 11:26 ` stefan
2001-10-11 11:33 ` stefan
2001-10-15 18:16 ` David Mosberger
2001-10-15 18:19 ` David Mosberger
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=marc-linux-ia64-105590698805251@msgid-missing \
--to=stefan@lkcc.org \
--cc=linux-ia64@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.