Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!sun!imagen!atari!apratt From: apratt@atari.UUCP (Allan Pratt) Newsgroups: comp.sys.atari.st Subject: Re: Preloading revised Message-ID: <1494@atari.UUCP> Date: 11 May 89 19:46:23 GMT References: <1028@philmds.UUCP> Organization: Atari Corp., Sunnyvale CA Lines: 34 In article <1028@philmds.UUCP>, leo@philmds.UUCP (Leo de Wit) writes: > For those who might be interested, here's a demo program that preloads > some programs (whose pathnames are supplied on the command line), then > executes them. It uses the Pexec variants 3, 4 and 5 to do so. Compiled > with Lattice C. > Enjoy! > Leo. The program Leo posted should work fine. It uses Pexec 3 (load/nogo) once per program you're loading, but then uses Pexec 5 (create basepage) followed by Pexec 4 (just go) on *that* basepage (after filling it in) once per execution of a preloaded program. This is fine; nothing wrong with it at all. Excellent solution. Except for one thing: some programs expect their basepage to be $100 bytes below their text base. In fact, virtually all programs make that assumption to one extent to another, but most of them use it to determine how to Mshrink, and being off by $100 bytes won't matter. And another thing: a program which assumes any initial state for a variable in the data or BSS segment will lose, because the second time you start it the variable will have a leftover value from the previous execution. You can fix this problem by saving a copy of the initial data segment and copying it into the process before starting it again, and clearing the BSS (just the declared part; you don't usually have to clear the whole heap). If a program modifies its text segment, this'll lose, but hell, at that point it'll be quicker just to load it off a RAMdisk. Very cool idea. I might try to add some builtins to Gulam this way. ============================================ Opinions expressed above do not necessarily -- Allan Pratt, Atari Corp. reflect those of Atari Corp. or anyone else. ...ames!atari!apratt