delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/18/04:31:50

Date: Sun, 18 Jul 1999 11:29:17 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: wanis AT my-deja DOT com
cc: djgpp AT delorie DOT com
Subject: Re: GPF due to _farpokel
In-Reply-To: <7mo6vl$r5e$1@nnrp1.deja.com>
Message-ID: <Pine.SUN.3.91.990718112856.19517T-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 16 Jul 1999 wanis AT my-deja DOT com wrote:

> cardbasemem = PCIbios_getbasemem();
> void writetocardmem ( unsigned long address,
> unsigned long data )
> {
>    _farpokel ( _dos_ds, cardbasemem + address,
> data );
> }
> /* 'address' is usually 0x00400004 */
> 
> This crashed inside the _farpokel().

_dos_ds cannot be used to access memory outside the 1st MByte, its
limit is 1MB+64KB, so the above is expected to GP Fault.  You need to
create your own selector to access memory above 1MB.  See section 18.7
of the FAQ.

> cardbasemem = PCIbios_getbasemem();
> ...Get create LDT for cardbasemem,
>    Memory size is 0x00800000
>    get selector for LDT
>    This code comes straight from the FAQ...
> cardbasemem = mi.baseaddress;
> /* cardbasemem still turns out to be 0xFF000000 */

Please post the unabridged code that you used to set up the selector.
Did you use the code in section 18.7 as the base?  If not, please use
it; if you did, make sure you don't omit anything from there.

In general, you need to map the physical address to a selector, not
only to create a selector.

> The results of SYMIFY tell me...
> 1)  The GPF is occurring inside _farpokel()
> (besides which, when I run the code with
> everything but that _farpokel() in there, it
> works just fine...)

Print the base address and the limit of the selector that you are
using, and compare them to what you want them to be.  It's possible
that one of the DPMI functions you called failed for some reason, so
you are trying to use an invalid selector.

- Raw text -


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