delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/15/02:55:33

Date: Mon, 15 May 2000 10:55:30 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Malcolm Herring <malcolm DOT herring AT btinternet DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: DPMI GPF problem
In-Reply-To: <8fn6cd$p85$1@neptunium.btinternet.com>
Message-ID: <Pine.SUN.3.91.1000515105456.9209P-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 14 May 2000, Malcolm Herring wrote:

> I need to map to a physical address range to access a memory-mapped device.
> The following code fragments is how I have tried to do it, but this results
> in a GPF when 'movedatal' is called.

Your code has a number of bugs.  First, it sets the segment limit
incorrectly:

>     __dpmi_set_segment_limit(sel, mmem.address + 65535);

This should be:

     __dpmi_set_segment_limit(sel, 65535);

>  _movedatal(_my_ds(), (int)&prng, sel, mmem.address, 1);

This is also wrong: the 4th argument is an *offset* into the segment,
so it starts from zero, not from mmem.address.

Btw, section 18.7 of the DJGPP FAQ list explains how to do this and
includes working code that does it.  I suggest to use that code as a
basis for your program.

If something in the FAQ is unclear, please ask specific questions.

>     __dpmi_set_descriptor_access_rights(sel,
> __dpmi_get_descriptor_access_rights(_my_ds()));

This call is unnecessary: the segment descriptor already has the same
rights as DS by default.

- Raw text -


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