delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/22/12:01:52

Date: Wed, 22 Dec 1999 17:18:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Ghalos <greg AT holdridge7 DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Sound DMA
In-Reply-To: <83qb6n$9ta$1@news7.svr.pol.co.uk>
Message-ID: <Pine.SUN.3.91.991222171122.27851H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 22 Dec 1999, Ghalos wrote:

> I have two
> buffers... one mixing buffer in protected mode memory and a copy of it for
> the DMA buffer in DOS memory... what I want to know is... assuming I have
> locked both of these buffers

You don't need to lock the buffer in DOS memory, it is locked by 
default.  In fact, many DPMI servers will fail the function that
locks memory if called with an address in the first MB range.

> and the handler function.... is it safe to use
> functions like memset() and dosmemput() in an interrupt handler.... do I
> need to lock them?

It is safe to use these two functions in an interrupt handler, but
you do need to lock all their code.  You also need to lock the stack, 
since the arguments to those functions are passed via the stack.

> how do I do it?

The only good way is to lock everything, since there's no way to
know the size of a function (unless the function has a special label
at its end, specifically for that purpose).

If locking everything, as described in the FAQ, is not an option, your 
best bet would be to copy the source of memset and dosmemput from the 
library (they are both written in assembly), add the labels at each 
function's end that will allow you to compute their size, and then lock
them.

As for the stack problem, you can work around it by modifying memset
and dosmemput (after you copy them) slightly, so that they access the 
arguments via global variables.

- Raw text -


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