Date: Tue, 14 Jan 1997 08:40:43 +0200 (IST) From: Eli Zaretskii To: Peter Berdeklis cc: djgpp AT delorie DOT com Subject: Re: Help! __dpmi_lock_linear_region wont! In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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. > > `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.