Date: Mon, 15 May 2000 10:55:30 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Malcolm Herring cc: djgpp AT delorie DOT com Subject: Re: DPMI GPF problem In-Reply-To: <8fn6cd$p85$1@neptunium.btinternet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.