Mail Archives: djgpp/1999/07/18/04:31:50
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 -