Referencing through a null pointer

Chip Salzenberg chip at ateng.UUCP
Thu May 5 00:39:38 AEST 1988


In article <50676 at sun.uucp> guy at gorodish.Sun.COM (Guy Harris) writes:
>(I seem to remember a claim that the '286 or '386 port of S5 has no
>location zero, and the Motorola 68K port may also have no location zero;
>alas, none of the fixes made to programs that broke got folded back into
>the mainstream S5 releases.)

The following comments apply to the '286 in protected mode.

In small and medium models (<= 64K of data), it is possible to set up the
data segment so that offset zero doesn't exist.  I don't know of any
implementations that bother to do this.  (Which is unfortunate.)

In compact and large models (data limited only by memory/swap space), a
NULL pointer is (in all implementations I know of) 32 bits of zeros.  This
value for NULL causes a protection trap whenever it is dereferenced, since
the '286 defines segment selector zero to mean "no segment".

-- 
Chip Salzenberg                "chip at ateng.UU.NET" or "codas!ateng!chip"
A T Engineering                My employer may or may not agree with me.
  "I must create a system or be enslaved by another man's." -- Blake



More information about the Comp.unix.wizards mailing list