Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!cbmvax!higgin From: higgin@cbmvax.cbm.UUCP (Paul Higginbottom) Newsgroups: net.micro.amiga Subject: Re: making reentrant code for "resident" programs Message-ID: <620@cbmvax.cbmvax.cbm.UUCP> Date: Wed, 13-Aug-86 09:10:34 EDT Article-I.D.: cbmvax.620 Posted: Wed Aug 13 09:10:34 1986 Date-Received: Thu, 14-Aug-86 21:15:40 EDT References: <661@usc-oberon.UUCP> <1468@amiga.amiga.UUCP> <870@tekigm.UUCP> <1478@amiga.amiga.UUCP> <969@hoptoad.uucp> Reply-To: higgin@cbmvax.UUCP (Paul Higginbottom) Organization: Commodore Technology, West Chester, PA Lines: 35 In article <969@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >In article <1478@amiga.amiga.UUCP>, jimm@amiga.UUCP (James D. Mackraz) writes: >> 2) Perhaps the Lattice C Compiler can create re-entrant code. > >There is no way an average C program can get by without using global >variables (eg errno, the standard-I/O file tables, etc). That's if you're using - true, to be portable you probably would be, but often on the Amiga it makes more sense to use native AmigaDOS calls. >A properly written compiler can support reentrancy -- even in a system >without memory management -- by making global data references relative >to an address register (rather than using the slow, cumbersome absolute >addressing mode most compilers use). I don't know of any that do this, >however, since there are complications involved. Well, it just so happens there is one that does it this way! Manx's Aztec C uses register a4 as a segment register, when using the (default) small model mode (which doesn't limit you to 64K code, by the way, just 64K of global data - pretty unlikely!). So the Manx system COULD be modified to have each call to a program initialize a4 with another segment by going through the seglist of the program, and then just tacking another on the end. It would be work, but not a massive amount I don't think. This was accomplished nicely on a UNIX-like operating system I worked with - rather than re-entrancy, this idea is shared images. >-- >John Gilmore {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu jgilmore@lll-crg.arpa > May the Source be with you! Paul Higginbottom {caip|seismo|ihnp4}!cbmvax!higgin (I think) May the Fource be with you! Disclaimer: I do not work for Commodore and my opinions are my own.