X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Wed, 6 Feb 2002 10:01:29 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: hskim cc: djgpp AT delorie DOT com Subject: Re: PCI Memory mapping? In-Reply-To: <_q%78.2592$4o2.105655@news.bora.net> 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 Wed, 6 Feb 2002, hskim wrote: > meminfo.handle = 0xf5800000; > meminfo.size = 0x200000; > meminfo.address = 0; > > nRet = __dpmi_physical_address_mapping(&meminfo); > > printf("Result = %d, %08x,%08x,%08x\n", > nRet, > meminfo.handle, > meminfo.size, > meminfo.address); > if (nRet) > return; > > p = meminfo.address; > > p[0] = 0; // program is crashed! That's because you didn't allocate a selector for accessing this memory, and didn't set up that selecor's segment to span the range of addresses you want to access. __dpmi_physical_address_mapping only creates a mapping between physical addresses and logical addresses, but doesn't provide a selector to access the mapped memory. See section 18.7 of the DJGPP FAQ list, it shows a skeleton of code that does all of the above.