www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/19/10:49:09

Date: Thu, 19 Dec 1996 10:34:34 -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: Question about hardware interrupts...
In-Reply-To: <Pine.SUN.3.91.961219082005.24763E-100000@is>
Message-ID: <Pine.SGI.3.91.961219101926.9361A-100000@chinook.physics.utoronto.ca>
MIME-Version: 1.0

Sorry if I'm being obtuse Eli, but here it goes...


On Thu, 19 Dec 1996, Eli Zaretskii wrote:
> On Mon, 16 Dec 1996, Peter Berdeklis wrote:
> 
> > Even if you are temporarily in real mode (calling a 
> > DOS function), the interrupt still goes to pmode first, no?
> 
> Yes, it does, but this interrupt reflection costs you many CPU cycles,
> because it involves a switch from real to protected mode (which eats up
> many hundreds of cycles), and some heavy bookkeeping by the DPMI host.  
> When you install a real-mode handler, it handles the interrupt entirely 
> in real mode, so you save the overhead.  

I understand that the interrupt reflection is expensive.  Still the FAQ 
says that "When your program runs under a DPMI host, hardware interrupts 
are always passed to protected mode first, and only if unhandled are they 
reflected to real mode."  Are you saying that if you are temporarily in 
real mode that you are temporarily not running under a DPMI host, so the 
real mode interrupt gets it first?  I didn't understand it that way.


> > While we're on the subject, is there any reason that enable() and 
> > disable() aren't inlined in the header file?
> 
> That's because you run in protected mode, where you generally are not
> allowed to actually disable the interrupts.  STI and CLI are priviledged
> instructions in protected mode, which cause exception and are caught by
> the DPMI host, or the memory manager, or Windows (depends on your system
> configuration) which then does whatever it thinks is appropriate.

Of course.  Didn't think about that. :)

> In DJGPP, `disable' and `enable' directly call the DPMI service which sets
> and clears the *virtual* interrupt disable flag (which only disables
> interrupts to your program, but not to the entire system), so they aren't
> easily expressable as inline assembly.  It also doesn't make sense IMHO,
> since the DPMI call is quite heavy anyway. 


So in a real mode handler you shouldn't be calling disable() and 
enable(), but rather cli and sti, so that you don't have to make a switch 
to and from prot. mode?


Thanks for your help Eli.



P.S. While I've got your attention... I have the latest version of Info.  
I've compressed the info files, but Info doesn't find them with the 
extension changed, e.g. from info to inz.  I had to change all the 
references in the directories.  I have LFN=y - is that the problem.

Thanks again.


Pete

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

- Raw text -


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