www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/18/00:26:24

Sender: nate AT cartsys DOT com
Message-ID: <35888C74.E9620CE7@cartsys.com>
Date: Wed, 17 Jun 1998 20:41:40 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Bernhard Gleich <bgleich AT blitz DOT chemie DOT uni-ulm DOT de>
CC: djgpp AT delorie DOT com
Subject: Re: physical memory location
References: <3587e7b1 DOT 0 AT news DOT uni-ulm DOT de>

Bernhard Gleich wrote:
> 
> Hi all
> 
> This question should be in the FAQ, but I didn't find it.
> 
> I'm trying to do some PCI DMA transfer. For this I need to know where
> the physical address of my allocated memory is. But I could not find
> any function that returns me this value. Could anyone point me to this
> type of information?

Unfortunately, you can't.  The way the DPMI server handles memory, a
given chunk of memory can reside anywhere in physical memory, or even in
several different places (noncontiguously).

The usual solution is to allocate some DOS memory (with
__dpmi_allocate_dos_memory), since you *do* know where it resides (in
the low 1M), and then use that as your DMA buffer.

> Note: Currently I'm doing the DMA in a very strange way: Allocate
> (malloc) most of the memory. Clear this memory. Do a DMA transfer to a
> random physical address. Check were the memory content is changed. Now
> DMA transfer to known position in the malloced memory is
> possible. This works most of the time.

That is a **horrible** idea.  Perhaps it works most of the time, but
sometimes it will fall right on top of DOS, or something equally vital,
and everything will go to Hades in a handbasket.  If you get really
lucky, it will hit your disk cache. :-o
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


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