Date: Sat, 10 Jun 2000 15:15:27 +0530 (IST) Message-Id: <200006100945.PAA14877@bgl2.vsnl.net.in> From: Prashant TR To: eliz AT is DOT elta DOT co DOT il CC: djgpp AT delorie DOT com In-reply-to: <200006100646.JAA13833@mailgw1.netvision.net.il> (eliz AT is DOT elta DOT co DOT il) Subject: Re: far pointers References: <39405DEE DOT 89226F7B AT ccs DOT iitb DOT ernet DOT in> <39415453 DOT 5E434718 AT is DOT elta DOT co DOT il> <200006100646 DOT JAA13833 AT mailgw1 DOT netvision DOT net DOT il> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > > > That means programs like DOS can coexist with protected-mode programs. > > > > > > I don't think V86 has anything to do with RM and PM programs coexisting. > > > perhaps I'm missing something in your reasoning. > > > > That statement is right. Because without V86 mode, you wouldn't be > > able to run any of your DOS programs without swicthing back to real > > mode (which is terribly slow). And when a program run in V86 mode, it > > *is* running in PMode at PL3. So this statement is right. > > Sorry, I still don't follow your reasoning; the above paragraph > contains several contradictions. > > First, you *can* run protected-mode programs on top of plain real-mode > DOS: that's what CWSDPMI does, for example, when it runs without EMM > or QEMM installed; the speed of the mode switch is not really relevant > here. This fact alone seems to go against your text, which suggest > that V86 allows DOS and PM programs to coexist (meaning that without > V86, such coexistence is impossible). Ok, that was not what I really meant. It was supposed to say that V86 allows both DOS and protected-mode programs to run *in* protected mode. Of course, it's true that you can run PM programs from real mode. Otherwise, we wouldn't be having Windows or Linux. ;-) > Second, even in V86 mode, a protected-mode program that calls > real-mode DOS services needs to make an explicit PM-to-RM switch, or > it will crash. So there's nothing in V86 per se that allows or makes > it simpler for PM programs to coexist with DOS. Faster, yes, but not > simpler. Not necessarily. There's no need for any program to make a switch to real mode even when DOS/BIOS calls are made. That's what makes the V86 so special. The 386 generates either a GPF or Exception 6 for instructions IRET, LOCK, POPF, PUSHF, PUSHFD, POPFD, CLI and STI (and of course the privileged instructions). So you can actually emulate all these instructions. A simple V86 stack-frame setup should do the job. That's what I did when I wrote my DOS Extender long ago. But then, if it isn't worth the pain, you could just set IOPL to 3 and let everything loose. I *think* this is what CWSDPMI is doing. And the statement does not necessarily mean that coexistence is impossible without V86. It just means that coexistence is possible with the V86 ;-). OTOH, yes, this is faster, but definitely not a simple job. :-( > In fact, I think that V86 should not be mentioned at all in the kind > of tutorial that you are writing. It is not really important in the > context of DJGPP, but it does complicate things and confuses newbies. > I don't expect many DJGPP users to write a V86 monitor ;-) Ok, I'll add most of the in-depth stuff elsewhere. My intention was to write a general tutorial about PM and mention some features that DJGPP is using (such as the 4GB selector). > > > The memory management unit (MMU) on the 386 supports virtual memory > > > > > > This is inaccurate: VM is not implemented by MMU, but by software that hooks > > > the Page Fault exception and pages memory in and out as needed. > > > > The word "support" is the key here. > > An MMU can hardly ``support'' something that it doesn't know about. > IMHO, the paragraph I commented about does not help to understand what > the MMU is. It might confuse people into thinking that MMU has some > important part in the implementation of VM, which is not true. Ok, I'll change that line to "The MMU on the 386 provides features that allow Virtual Memory to be implemented". Does it make the tutorial more clear?