www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/21/06:39:16

Date: Sun, 21 Sep 1997 13:35:56 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Chirayu Krishnappa <chirayu AT radiolink DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: far pointers
In-Reply-To: <1.5.4.16.19970921094535.392f7f90@giasbga.vsnl.net.in>
Message-ID: <Pine.SUN.3.91.970921133533.9556X-100000@is>
MIME-Version: 1.0

On Sun, 21 Sep 1997, Chirayu Krishnappa wrote:

> The FAQ sez that we have to wary of the base address changing after a
> malloc(), system(), spawn...() etc. call. My question is that when the base
> address changes, dont all pointers go haywire (including near pointers,
> etc).

What near pointers are you talking about?  If that's the usual
pointers you use in any C program, then, they do NOT go haywire
because all pointer-based accesses in protected mode are indirect: the
pointer is just an offset into the segment, and the base is taken from
the descriptor.  So after the base address changes, all memory
accesses immediately and magically know about this change.

If you are talking about the DJGPP nearptr facility, then they indeed
will go haywire unless you use the `__djgpp_conventional_base'
variable whose value is recomputed when the remapping happens.

> Could somebody point me to a good online introduction or tutorial
> describing prot. mode mem. management

Try the "Programmer's Technical Reference: The Processor and
Coprocessor", by Robert Hummel, Ziff-Davis Press, 1992.

> (and everything else if possible).

For ``everything else'' the canonical reference is "The Hitchiker's
Guide to the Galaxy" ;-).  It includes the answer to the Question of
Life, the Universe, and Everything.

> And one other thing. My friend uses a Watcom compiler and guess how he uses
> video mem. 
> 
> char *p=(char *)0xA0000; *(p+something)=color. 
> 
> thats it. No farptr functions or anything. how does watcom manage this. I
> thought maybe watcom was always in nearptr mode, but if so, wont the base
> address need to e recalculated or something? 

I'd gues that Watcom can do that because it uses a DOS extender which
catches all system calls and does its thing behind the scenes.  DJGPP
v1.x did similar things (its extender remapped the first megabyte to
a specific constant address).  DJGPP v2 doesn't have such liberty,
since it doesn't have an extender, and needs to work with all the
different DPMI hosts out there.

- Raw text -


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