delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/08/18/23:45:27

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
NNTP-Posting-Date: Tue, 18 Aug 2009 22:33:44 -0500
From: "Charles Sandmann" <cwsdpmi AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <ddc847db-306e-496a-999a-34c0542c7a9b AT g31g2000yqc DOT googlegroups DOT com> <G5OdnX1ixc6NZhTXnZ2dnUVZ_oednZ2d AT earthlink DOT com> <af14bd7c-f2ed-4d59-bac8-59c374604d9e AT a37g2000prf DOT googlegroups DOT com>
Subject: Re: freedos and cwsdpmi with djgpp under Linux?
Date: Tue, 18 Aug 2009 22:33:34 -0500
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Message-ID: <EpOdncb3wIEF7xbXnZ2dnUVZ_hudnZ2d@earthlink.com>
Lines: 49
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 64.91.192.48
X-Trace: sv3-otDtMMWZxg1U95ehWehzbd66rplLOL342DBe+jirJRVrWnOouCiNJe6cOGE63q+GiSMk4Gwo6MXxOx8!s4JfMvpxsFhmBxaeZ73tadisD/LjX7YZN1cPgXbi0pq2hZSgC1v4dUE3xf6jDp0AD+wq8rgrqFaV!E93k351DrB5WftEKt/RuZMCbFSSQ6gs=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.39
X-Original-Bytes: 3320
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>> If you absolutely need an XMS block, you need to
>> "prepare" for it before running CWSDPMI (such as
>> allocate the block you need, allocate a second tiny block,
>> release the first block).
>
>  I don't suppose you have an example of this method?

Not immediately, it's on a CD someplace (using TC if
I remember correctly).  In a pinch it could be done with
debug.com :-)

>  Basically I need a 1 Megabyte DMA buffer for a PCI card that has DMA
> capability.

OK!

>  I got both cwsdma.zip and cwsdma2.zip, thanks for passing those
> along.  When I run #2 I get:
>
> Allocated 8M DMA buffer at DJGPP address 0x93b00, physical 0x113b00
> Virtual: 0x1000  Physical: 0x100000  Size: 0x13000
> Virtual: 0x91000  Physical: 0x916000  Size: 0x1000
> Virtual: 0x92000  Physical: 0x914000  Size: 0x1000
> Virtual: 0x93000  Physical: 0x113000  Size: 0x1000
> Virtual: 0x94000  Physical: 0x115000  Size: 0x7ff000
> Virtual: 0x893000  Physical: 0x114000  Size: 0x1000
> Virtual: 0x897000  Physical: 0x915000  Size: 0x1000
>
>  Looking at the Physical address, it's apparent that they are not
> contiguous.  If I used XMS would I get a contiguous one?

XMS would make it contiguous.  But in the example above, you have
a nice big chunk.  If you look closely at the physical addresses you
can see it's actually even more contigous than it intially appears.
Potentially you should allocate the memory using sbrk() instead of
malloc(), then immediately touch it all (in sequence) to make sure
it is contiguous.  Or do your own scatter/gather.

(note that chunk 1 -> chunk 4 -> chunk 6 -> chunk 5 -> chunk 3
-> chunk 7 -> chunk 2 is all contiguous).

Advantage of doing your own internal allocation and mapping
is that it does not depend on XMS (it will work in raw mode
without XMS, or even with EMM / VCPI loaded and no
preparation program).  But if you only need 1MB, and allocate
2MB you can probably find a nice contiguous 1MB chunk
someplace without even bothering to map. 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019