Date: Mon, 29 Nov 1999 08:45:54 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp AT delorie DOT com Subject: Re: nearptr access to memory mapped devices In-Reply-To: <81s582$bmt$1@nntp8.atl.mindspring.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 28 Nov 1999, Marp wrote: > I have a question about accessing a memory mapped device using a near > pointer. I was reading through the vbe 3.0 spec and it suggested the > following to access the linear frame buffer: I'm not sure VBE spec is relevant for your case, because VBE talks about a device that is already mapped into the address space (SVGA), while an arbitrary memory-mapped device is not. See below. > void *lfbptr; > __dpmi_meminfo meminf; > unsigned long baseaddr; > > /* step 1 */ > meminf.address = address_of_lfb; > meminf.size = size_of_lfb; > __dpmi_physical_address_mapping(&meminf); > > /*step 2 */ > __dpmi_get_segment_base_address(_my_ds(), &baseaddr); > > /* step 3 */ > lfbptr = meminf.address - baseaddr; > /* code ends */ > > The problem is that when I go to use lfbptr, I get SIGSEGV. Please re-read section 18.7 of the FAQ. It shows you that a few additional DPMI calls are needed before you can access the memory-mapped device. Specifically, your call to __dpmi_physical_address_mapping mapped the device into memory, but you don't have any selector set up to access that memory. That's why it SIGSEGVs. If you want nearptr access to that device, you need to extend the limit of the DS selector to cover the addresses up to the top of the memory on board the device. Why do you need to mess with nearptr, anyway? Isn't the method suggested in the FAQ good enough? It *does* work.