Mail Archives: djgpp/1999/12/22/12:01:52
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 -