From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: stefan Newsgroups: gmane.lisp.guile.devel,gmane.linux.ports.ia64 Subject: Guile garbage collector on ia64-linux Date: Wed, 25 Jun 2003 04:58:59 +0200 (CEST) Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <15307.10445.674412.197780@napali.hpl.hp.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1056510666 30633 80.91.224.249 (25 Jun 2003 03:11:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 25 Jun 2003 03:11:06 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 25 05:11:01 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19V0fH-0007v9-00 for ; Wed, 25 Jun 2003 05:09:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19V0eJ-0003HD-K3 for guile-devel@m.gmane.org; Tue, 24 Jun 2003 23:08:43 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19V0dp-0002eF-OS for guile-devel@gnu.org; Tue, 24 Jun 2003 23:08:13 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19V0dj-0002Sh-4e for guile-devel@gnu.org; Tue, 24 Jun 2003 23:08:07 -0400 Original-Received: from obh.snafu.de ([213.73.92.34]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19V0di-0002I1-99 for guile-devel@gnu.org; Tue, 24 Jun 2003 23:08:06 -0400 Original-Received: from p-164-211.zrz.tu-berlin.de ([130.149.164.211] helo=bono) by obh.snafu.de with asmtp (TLSv1:DES-CBC3-SHA:168) (Exim 3.36 #1) id 19V0db-000Fei-00; Wed, 25 Jun 2003 05:08:02 +0200 Original-Received: from localhost ([127.0.0.1]) by bono with esmtp (Exim 3.36 #1) id 19V0Ut-00004C-00; Wed, 25 Jun 2003 04:58:59 +0200 X-X-Sender: stefan@bono.reversers.net Original-To: David Mosberger In-Reply-To: <15307.10445.674412.197780@napali.hpl.hp.com> Original-cc: linux-ia64@linuxia64.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2575 gmane.linux.ports.ia64:1971 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2575 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 #include 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