delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/14/12:39:33

Date: Tue, 14 Jan 1997 11:59:29 -0500 (EST)
From: Peter Berdeklis <peter AT chinook DOT physics DOT utoronto DOT ca>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
cc: djgpp AT delorie DOT com
Subject: Re: Help! __dpmi_lock_linear_region wont!
In-Reply-To: <Pine.SUN.3.91.970114083112.11860F-100000@is>
Message-ID: <Pine.SGI.3.91.970114111330.28579C-100000@chinook.physics.utoronto.ca>
MIME-Version: 1.0

On Tue, 14 Jan 1997, Eli Zaretskii wrote:

> 
> On Mon, 13 Jan 1997, Peter Berdeklis wrote:
> 
> > > AFAIK, DOS memory is always locked anyway.  So why do you want to lock 
> > > it?
> > 
> > Note that I can not find anything in the DPMI spec that says that DOS
> > memory must be locked.  In fact the function "Mark Real Mode Region as
> > Pagable" says, "Under some  implementations  of  DPMI,  all  memory  in
> > virtual 8086 mode is locked by default."  This suggests that under some 
> > implementations it isn't.
> 
> If you run that program above DOS, AFAIK it is locked by all DPMI hosts. 
> Otherwise, DOS itself could have been paged out, with obvious
> consequences.  Windows/NT and Linux/DOSEmu might not lock it, but would
> your program at all work on these platforms?  If not, you shouldn't be 
> worried by them.


Yes, my program should work under Win or Linux, but it will probably 
never be used other than under DOS.  This is more a learning experience 
Eli - not production code but code for an instrument in my lab.


> > > `real_mode_int_segment' isn't a valid protected-mode address (else you 
> > > could just dereference it as a pointer, instead of the farptr, dosmemget 
> > > and such, right?), that's why the call fails (I think).
> > 
> > I know that the segment is not a PMode selector.  The function 
> > __dpmi_lock_linear_region requires the _linear_ address of the memory to 
> > be locked.
> 
> Yes, but real_mode_int_segment << 4 isn't strictly speaking a linear
> address either, it's an offset relative to _dos_ds base.  When you lock a 
> region in your program, you use linear addresses relative to your 
> program's DS base, which is different.  Try enabling nearptrs and use 
> __djgpp_conventional_base + (real_mode_int_segment << 4) as the argument 
> to the locking call.

real_mode_int_segment << 4 is strictly speaking a physical address. I
assumed that when the DPMI spec says linear address it meant physical
address, not 32 bit offset into a given segment. 

I wrote a small proggy to test your nearptr suggestion.  Very interesting
results. 

In a DOS box under Win95, near pointer addresses fail to lock, but the 
segment * 16 locks fine.  In DOS under CWSDPMI, near pointer addresses 
lock, but segment * 16 it fails.  Obviously there is a disagreement 
regarding the interpretation of the text here too.

Anybody know who's right?  (My heart is definitely with Charles, even 
though my interpretation isn't. :)

---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto


- Raw text -


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