Xref: utzoo comp.lang.c:14350 comp.sys.m68k:1031 Newsgroups: comp.lang.c,comp.sys.m68k Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Messing with 0 ptr on m68020 & sys V / 68 Message-ID: <1988Nov29.175253.23217@utzoo.uucp> Organization: U of Toronto Zoology References: <784@clinet.FI> <1564@nud.UUCP> Date: Tue, 29 Nov 88 17:52:53 GMT In article <1564@nud.UUCP> df@nud.UUCP (Dale Farnsworth) writes: >... Once upon a time, the standard UNIX distribution >from AT&T ran on the PDP-11 family. The instruction which began each program >(from crt0.o) just "happened" to have a zero-valued first byte... Not quite correct. The first instruction did not in fact have a zero low byte (or a zero high byte). However, when a pdp11 program was compiled split-space, to get maximum address space on a large 11, a one-word "shim" was inserted at location 0 in data space to ensure that no legitimate variable ever got put there (since C guarantees that &x != 0 for any x). The shim, unfortunately, was a zero. Most large and complex programs needed split space, so their developers got used to having a readable zero at location zero. Friends of mine (at HCR) ran into this when using overlaying to make the big stuff work on small (non-split-space) 11s. They ended up inserting a contrived instruction with a zero low byte at the beginning of the startup code. (They would have preferred a zero word, but that's a HALT instruction -- illegal in user mode -- on the 11!) -- SunOSish, adj: requiring | Henry Spencer at U of Toronto Zoology 32-bit bug numbers. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu