Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ccvaxa Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!marick From: marick@ccvaxa.UUCP Newsgroups: net.emacs Subject: Re: gnu design question Message-ID: <11600009@ccvaxa> Date: Sun, 5-Jan-86 21:36:00 EST Article-I.D.: ccvaxa.11600009 Posted: Sun Jan 5 21:36:00 1986 Date-Received: Tue, 7-Jan-86 03:48:06 EST References: <21@cornell.UUCP> Lines: 50 Nf-ID: #R:cornell.UUCP:21:ccvaxa:11600009:000:2017 Nf-From: ccvaxa.UUCP!marick Jan 5 20:36:00 1986 Setjmp/longjmp work just fine on Gould machines; only alloca() is missing. I haven't looked at unexec in gnumacs, but I've written a rather large program that does something similar for much the same reason. It might be nice for unexec to be a library routine, but in my experience those people who use it all need to do something slightly different -- you need an example, not a library routine. I can't provide a full example, but I can tell you how to write an unexec-like thing for ZMAGIC files: 1. Find the old executable -- you'll need it for the symbol table. The Franz Lisp gstab() routine is an example of what you need to do. 2. Unlink the destination file (so creat() doesn't reuse the modes). 3. Fetch the old header (out of the old executable or starting at the first word of this process's text space). 4. Fill in the new header -- note that both header.a_data and header.a_nbdata must be updated if you've used sbrk(). 5. Write the new header out. Its size in bytes is ZTXTOFF (from a.out.h). 6. Write the text out, starting at header.a_txbase + ZTXTOFF and going for header.a_text-ZTXTOFF bytes. 7. Write the data out. header.a_text is rounded up to a multiple of pages, so you don't have to. 8. Copy the symbol and symbol tables from the old executable to the new one. The symbol table starts at a_text + a_data in the old executable. The only problem I know of is a bug in signal handling. In (at least some distributions of) UTX, sigvec breaks when called "again" from a saved process image. See sigvec.s -- you will need to do a setsigc system call to get around the problem. This bug will be (has been?) fixed in later versions of UTX. Hope this helps someone. Usual disclaimers about opinions apply; further, I've been known to make mistakes both writing and reading code, so anything I wrote above could be wrong. Brian Marick, Wombat Consort Gould Computer Systems -- Urbana ...ihnp4!uiucdcs!ccvaxa!marick ARPA: Marick@GSWD-VMS