Mail Archives: djgpp/1997/01/14/12:39:33
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 -