delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/04/19:08:35

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 <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 -


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