From: "Malcolm Herring" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: DPMI GPF problem Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Message-ID: Date: Mon, 15 May 2000 18:15:36 -0700 NNTP-Posting-Host: 63.193.116.162 X-Complaints-To: abuse AT pacbell DOT net X-Trace: news.pacbell.net 958439766 63.193.116.162 (Mon, 15 May 2000 18:16:06 PDT) NNTP-Posting-Date: Mon, 15 May 2000 18:16:06 PDT Organization: SBC Internet Services To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com That did the trick! Thanks! "Eli Zaretskii" wrote in message news:Pine DOT SUN DOT 3 DOT 91 DOT 1000515105456 DOT 9209P-100000 AT is... > > 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. >