From: stefan <stefan@lkcc.org>
Cc: guile-devel@gnu.org
Subject: Guile garbage collector on ia64-linux
Date: Wed, 25 Jun 2003 04:58:59 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.44.0306250438590.251-100000@bono.reversers.net> (raw)
In-Reply-To: <15307.10445.674412.197780@napali.hpl.hp.com>
Hello David,
some time ago I was asking about the use of setcontext()/getcontext() on
ia64-linux for porting the garbage collector of GNU Guile to ia64 and with
your help I was able to write code something like this which initially
worked fine for Guile.
=========================================================================
/* This declares us ucontext_t but leaves setcontext()/getcontext()
undeclared. */
#ifdef __ia64__
#include <signal.h>
#include <sys/ucontext.h>
extern unsigned long * __libc_ia64_register_backing_store_base;
#endif /* __ia64__ */
/* [ ... ] */
#ifdef __ia64__
/* Extern declaration of getcontext()/setcontext() in order to redefine
getcontext() since on ia64-linux the second return value indicates
whether
it returned from getcontext() itself or by running setcontext(). */
struct rv
{
long retval;
long first_return;
};
extern struct rv getcontext (ucontext_t *);
extern int setcontext (ucontext_t *);
#endif /* __ia64__ */
#ifdef __ia64__
rv = getcontext (&continuation->ctx);
if (rv.first_return)
{
continuation->backing_store_size =
continuation->ctx.uc_mcontext.sc_ar_bsp -
(unsigned long) __libc_ia64_register_backing_store_base;
continuation->backing_store = NULL;
continuation->backing_store =
scm_gc_malloc (continuation->backing_store_size,
"continuation backing store");
memcpy (continuation->backing_store,
(void *) __libc_ia64_register_backing_store_base,
continuation->backing_store_size);
*first = 1;
return cont;
}
else
{
SCM ret = continuation->throw_value;
*first = 0;
continuation->throw_value = SCM_BOOL_F;
return ret;
}
#else /* !__ia64__ */
/* [ ... ] */
#endif /* !__ia64__ */
=========================================================================
This piece of code worked perfectly for us determining the location and
size of the backing store of the machine.
With newer installations this has changed and the code does not work
anymore. I know you stated somewhere in the past the set of
functions/structures has been introduced in glibc-2.2.3. I do not know
exactly which version is current know. The problem we need to solve for
the Guile garbage collection are as follows:
* have some header where ucontext_t is declared but
setcontext()/getcontext() is not -> so we can redeclare it to make
getcontext() return the 'struct rv'.
* determination of the size and location of the backing store; this has
been previously achieved by:
ctx.uc_mcontext.sc_ar_bsp -> the top
__libc_ia64_register_backing_store_base -> the bottom
Newer glibc headers don't have 'sc_ar_bsp', but things like
'ar_bsp_base' or 'ar_bspstore'. Can something in the structure
ucontext_t be used to achieve the same? Will this change often in the
future?
Thanks in advance,
stefan@lkcc.org
PS: I also CC'ed this to guile-devel, because the issue is a debian bug
for guile-1.6.4 and is still unresolved.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next parent reply other threads:[~2003-06-25 2:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15307.10445.674412.197780@napali.hpl.hp.com>
2003-06-25 2:58 ` stefan [this message]
2003-06-25 9:34 ` [Linux-ia64] Guile garbage collector on ia64-linux Andreas Schwab
2003-06-25 16:58 ` David Mosberger
2003-06-25 18:03 ` stefan
2003-06-25 18:07 ` stefan
2003-09-12 15:35 ` Marius Vollmer
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0306250438590.251-100000@bono.reversers.net \
--to=stefan@lkcc.org \
--cc=guile-devel@gnu.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).