delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/08/16:54:29

Message-ID: <2723E6389F55D311BDC200508B129547395A52@pai820exch003u.micro.lucent.com>
From: "Updegrove, Timothy (Tim)" <tupdegrove AT lucent DOT com>
To: "'Zaretskii, Eli'" <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp AT delorie DOT com
Subject: RE: Allocating DOS memory in Windows
Date: Mon, 8 Nov 1999 15:38:34 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

Eli,

I've imbedded my answers below.  Thank-you so much for following up and your
continued help.

> ----------
> From: 	Eli Zaretskii[SMTP:eliz AT is DOT elta DOT co DOT il]
> Sent: 	Sunday, November 07, 1999 10:10 AM
> To: 	Updegrove, Timothy (Tim)
> Cc: 	djgpp AT delorie DOT com
> Subject: 	Re: Allocating DOS memory in Windows
> 
> 
> On Thu, 4 Nov 1999, Tim Updegrove wrote:
> 
> > As I indicated below, just allocating DOS memory (and passing the
> segment to
> > the DMA hardware and using the selector in the program) works fine when
> > booting into MS-DOS.  The DMA hardware fetches the correct info.
> However,
> > running the same exact executable in a MS-DOS box under Windows, the DMA
> > hardware doesn't fetch the correct info in memory which was first
> written by
> > the program.  The DMA hardware fetches the same address in both cases
> but,
> > under Windows, the data that the program wrote isn't present (but is
> present
> > when booting to MS-DOS).
> 
> Perhaps you didn't program the DMA controller correctly.  Windows
> usually works behind the scenes to make DMA work as if you were
> running on DOS.
> 
From Tim: I'm programming a chip our group developed which is memory-mapped.
I believe I'm programming it correctly.  In programming our chip, a
descriptor is created in memory, the segment address of this descriptor is
written into a register using memory-mapped I/O, and the controller is told
to fetch the descriptor.  I don't believe the Windows driver is causing any
problems, even though it is loaded.

> > That is, the selector returned from allocating DOS memory under
> > Windows doesn't appear to point to the same data as the returned
> segment.
> 
> Please explain this in more detail.  How exactly did you arrive at the
> conclusion that the selector and the segment don't point to the same
> memory?
> 
From Tim: I believe the selector and segment under Windows points to
different memory areas because a logic analyzer on the PCI bus shows the DMA
controller uses the same segment address in both cases but the data read
from memory (the descriptor described above) is incorrect under Windows.
Since I can write and read the memory area (the descriptor) using the
selector in the program and from what I saw on the logic analyzer, I believe
the selector and segment must point to different areas.  Is there any way to
confirm this?  If there is, I'd be glad to check something if you send the
exact steps.

> > As indicated below, steps 2-5 work with Windows (but don't work when
> booting
> > to MS-DOS because the memory is already mapped) but I would like one
> > solution to work in both environments.
> 
> I think this is due to some bug.  But even if not, it should be easy
> to find out from within the running program whether you run on
> Windows, and employ the appropriate solution.
> 
From Tim: I'm not familiar with what to check to see if Windows is running.
Please send info if you know what to do.  This would be good for future
reference even if it is not needed here.  Again, I'd prefer a single working
solution if we can figure out what is wrong in Windows when just allocating
DOS memory.

- Raw text -


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