Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!princeton!allegra!ulysses!sfmag!sfsup!shap From: shap@sfsup.UUCP Newsgroups: comp.os.minix Subject: Re: MINIX on the Atari ST Message-ID: <1080@sfsup.UUCP> Date: Sat, 31-Jan-87 16:53:33 EST Article-I.D.: sfsup.1080 Posted: Sat Jan 31 16:53:33 1987 Date-Received: Sun, 1-Feb-87 07:39:07 EST References: <454@bobkat.UUCP> <253@vax1.ccs.cornell.edu> <486@bobkat.UUCP> Organization: AT&T-IS, Summit N.J. USA Lines: 34 Summary: Faking relocatability on the 68000 In article <486@bobkat.UUCP>, m5d@bobkat.UUCP (Mike McNally ) writes: > > Nobody has responded to my original query: how does the compiler (ACK?) > simulate the *complete* relocatability provided by the 8088 (small > model, of course) on the 68000? How does the OS copy my data segment > when my process does a fork()? What about the pointers; they're all > wrong! I just don't get it. First statement: I haven't done it, this is only conjecture. It might be done (at some cost) by coding as follows: 1. All jmp instructions and the like as relative jumps (for text relocatability). 2. Absolute addresses can be dealt with by implementing pointers as offsets, much like an 8086, and having the compiler generate the absolute address by doing in software the equivalent of what a segment register does. If you know where the user's user-info-block is, it might hold a pointer to the start of data space, which gets bumped when data space is moved. Then the code generator can generate code which does the pointer arithmetic whenever you dereference a pointer. So long as data space is contiguous, pointer arithmetic is still cheap. The only cost comes in dereferencing. *** end of conjecture: It would be slow, awkward, and difficult, but there are compilers which generate relocatable code for flat architectures. The principles (even though I don't know them) therefore have to be well understood. Jon Shapiro