www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/02/03:13:34

From: pjones AT acs DOT bu DOT edu
Subject: Re: NULL pointers...
To: heilig AT cs DOT und DOT nodak DOT edu (Zach Heilig)
Date: Wed, 2 Nov 1994 01:24:22 -0500 (EST)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

> Charles Sandmann says:
> > DPMI does not currently have null pointer protection, so under DPMI you
> > would currently just use whatever happens to be in page 0 of the memory
> > block.  Under V1.11 page 0 was never written, so your dpmi provider 
> > probably had it all zeros.  Due to a minor bug in the V1.12 LD, the
> > protection page wasn't being generated so the memory at location 0 was
> > being written with the COFF header (I think).  I can't be sure this is true, 
> > but because of the LD problem I don't think any (early?) V1.12 images
> > provide null pointer protection at all.
> > 
> > Anyway, it will all get fixed someday, and work under DPMI too.
> 
> Probably the easiest fix would be to change the NULL pointer to
> something way out of range, like maybe: 0xffffffff.  It may break some
> code to have it != 0x00000000, but that code was really broken anyway,
> since a NULL pointer is definately not guaranteed to be 0x00000000
> after translation is done.  I don't know if there is an easy way to
> make gcc translate a 0 in a pointer context to the real NULL pointer,
> though.
> 
> -- 
> 	Zach Heilig	(heilig AT aero DOT und DOT nodak DOT edu)

Hmm...  I would guess that having NULL != (void *) 0, even if it's not
supposed to be guaranteed to be that in the first place, would break more code
than we'd all like to imagine.  I definitely vote for getting the protection
on address 0x0 to work.

Peter Jones




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019