Date: Tue, 4 Jul 95 16:22 MDT From: mat AT ardi DOT com (Mat Hostetter) To: jscharrl AT ba-stuttgart DOT de Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: DPMI: page locking Newsgroups: comp.os.msdos.djgpp References: <3tb35v$3vb AT news DOT belwue DOT de> >>>>> "Jochen" == Jochen Scharrlach 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 #include 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