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. _______________________________________________ Linux-IA64 mailing list Linux-IA64@linuxia64.org http://lists.linuxia64.org/lists/listinfo/linux-ia64Received on Tue Jun 24 23:11:00 2003
This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:15 EST