delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/07/05:28:43

Date: Wed, 7 Oct 1998 10:27:51 +0100 (BST)
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: Jari Tuominen <jer64 AT hotmail DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Linear address 0 makes my day ;)
In-Reply-To: <19981007065343.24344.qmail@hotmail.com>
Message-ID: <Pine.OSF.4.05.9810071015020.10518-100000@sable.ox.ac.uk>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 6 Oct 1998, Jari Tuominen wrote:

> I have been wondering about CWSDPMI memory management,
> why it won't allow using of Linear Address 0?
> Windows DPMI allows it !
> Is there any ways to solve this annoying bug?

It's not a bug -- why do you think it's a bug?  Why are you
using linear address 0 at all?  Remember that these linear
addresses are relative to the base of whatever selector you are
using (presumably you're using the djgpp program's selector),
which is not the same thing as the base of physical memory.  
Use _dos_ds as the selector if you want to access physical
memory.  If you don't know what I'm talking about, read in the
djgpp FAQ chapters 17 and 18 (particularly section 18.4).

CWSDPMI crashes your program if it tries to access that memory
because the djgpp startup code asks it to.  There is absolutely
no reason why you could want to touch that memory -- it is not
used for anything at all.

The reason djgpp programs arrange to be crashed if they touch
the memory is that NULL pointers point here, and uninitialised
global pointers will be NULL.  You shouldn't ever dereference a
NULL pointer -- if you do it's a bug in your program -- and by
catching this error, djgpp can point you to this bug in your
program.  Windows's DPMI server does not support the feature
that allows the djgpp startup code to arrange this crash, so the
program does not crash.

If you like, you can turn off this feature, so that you can
access this memory, but I can't see any reason why you would
want to.  If you really do want to, read the include file
`crt0.h' for details.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

xu do tavla fo la lojban  --  http://xiron.pc.helsinki.fi/lojban/lojban.html

- Raw text -


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