X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: DMA and paging Date: Mon, 24 Sep 2007 16:48:37 -0400 Organization: Aioe.org NNTP Server Lines: 52 Message-ID: References: <46F7F665 DOT 1773 DOT 20651AE9 AT gerritvn DOT gpvno DOT co DOT za>, <46F82772 DOT 52 DOT 2124586E AT gerritvn DOT gpvno DOT co DOT za> NNTP-Posting-Host: IVw7K97ih4IohxRqyKkqFw.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse AT aioe DOT org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-Priority: 3 X-MSMail-Priority: Normal To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Rod Pemberton" wrote in message news:fd95kj$sgt$1 AT aioe DOT org... > "Gerrit van Niekerk" wrote in message > news:46F82772 DOT 52 DOT 2124586E AT gerritvn DOT gpvno DOT co DOT za... > > Have you actually done DMA programming using DJGPP and PMODEDJ ? > > No, I've not done any DMA programming with DJGPP. That was why I posted the > "?" - meaning I didn't have an answer to the rest of your original > questions. > > > Do you have any more pointers, warnings and/or gotchas if I simply > > malloc() a memory buffer and calculate the physical address by adding > > base from __dpmi_get_segment_base_address(_my_ds(),&base) to it ? > > 1) subtract base > 2) if you're getting DPMI crashes, you might want to try increasing the > segment limit (0x0009FFFF or so) by one method: > a) __dpmi_set_segment_limit(_my_ds(),0xFFFFFFFF) > b) __djgpp_nearptr_enable() > 3) you might want to try __dpmi_allocate_memory() instead of malloc() > 4) if you're using CWSDPMI or CWSDPR0 instead of PMODEDJ, you'll need to > a) call __dpmi_physical_address_mapping() > b) be aware that 0-1Mb is already physically mapped, so you'll need to map > 1Mb to xxMb. > c) my experience with CWSDPMI v5 indicates it can't physically map more > that 128Mb > d) IIRC, no errors were given for failures with b) and c) > e) you might want to try CWSDPMI v6 for a larger page size, and perhaps > more physically mapped memory... > 5) there is a small (64k or less) amount of memory pre-allocated below 1Mb > called a transfer buffer which you might be able to use instead of > allocating DOS memory by DPMI. Look into __tb, __tb_segment,__tb_offset. > 6) if you need memory below 1Mb and aren't using the transfer buffer, you can use __dpmi_allocate_dos_memory() 7) _dos_ds segment size can also be extended to 4Gb (0-4Gb physical) but you'll still have to use farptr.h functions. 8) Windows won't do some DPMI techniques the same as DOS with DPMI. e.g., memory mapping, segment limit increase 9) I've had problems with some of the _go32_* functions and don't like them. 10) The __dpmi_simulate_real_mode_interrupt() usually works. But, in one instance - for a non-returning interrupt, I had to simulate it using __dpmi_get_real_mode_interrupt_vector() and __dpmi_simulate_real_mode_procedure_retf(). RP