Mail Archives: djgpp/1995/07/04/19:08:35
>>>>> "Jochen" == Jochen Scharrlach <jscharrl AT ba-stuttgart DOT de> writes:
Jochen> Hi! I have trouble using the
Jochen> __dpmi_lock_linear_memory()-function: what do I have to
Jochen> fill into the "handle"-field of the __dpmi_meminfo-struct?
Jochen> Which address should I use (i.e. can I take the value of a
Jochen> pointer)? All I got until now are lock errors :(
Here's a slightly modified version of the function we use for Executor
(our commercial Mac emulator) under djgpp V2. Feel free to use it,
adapt it, whatever.
----------------------------------------------------------------------
#include <dpmi.h>
#include <sys/segments.h>
void
dpmi_lock_memory (void *start, unsigned long num_bytes)
{
unsigned long base = 0;
/* Get the linear base address. */
if (__dpmi_get_segment_base_address (_my_ds(), &base) != -1)
{
__dpmi_meminfo mem;
mem.handle = 0; /* Unused */
mem.size = num_bytes;
mem.address = (unsigned long) ((char *) start + base);
__dpmi_lock_linear_region (&mem);
}
}
----------------------------------------------------------------------
-Mat
- Raw text -