delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/05/28/21:50:49

Date: Tue, 28 May 1996 20:48:47 -0500 (CDT)
Message-Id: <199605290148.UAA04751@orion.math.uiuc.edu>
From: Dan Grayson <dan AT math DOT uiuc DOT edu>
To: djgpp-workers AT delorie DOT com
Subject: djgpp and unexec
Reply-to: drg AT uiuc DOT edu

I've been using a type of unexec (undump) routine for programs which dumps
only the data areas to disk.  The advantage of this approach is that I don't
have to learn object file formats on a zillion machines, and the dumped file
is a shorter, because it doesn't include the text.  The disadvantage is that
I have to take care of reinitializing things that depend on the environment,
like 'environ', for example, sigh.

I got it to work with djgpp but had to make a few changes.  It seems that
crt0.s stores some of its state in variables located in the data or bss
segments.  When I write over these, crucial things stop working, such as
communication with real-mode, etc.  So I simply changed all of crt0.s's
variables to the text segment.  Some were there already.  I also moved one of
crt1's variables, the go32 info block.

I don't expect you to much care for this approach to unexec'ing, especially
since emacs includes such fine code for this purpose, but it is pretty
simple.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019