www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/21/00:34:13

Newsgroups: comp.os.msdos.djgpp
From: Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca>
Subject: Re: Question about hardware interrupts...
Message-ID: <Pine.SGI.3.91.961220141846.22234A-100000@chinook.physics.utoronto.ca>
Nntp-Posting-Host: chinook.physics.utoronto.ca
Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator)
Mime-Version: 1.0
Organization: University of Toronto - Dept. of Physics
In-Reply-To: <Pine.SUN.3.91.961219082005.24763E-100000@is>
Date: Fri, 20 Dec 1996 19:46:51 GMT
References: <Pine DOT SUN DOT 3 DOT 91 DOT 961219082005 DOT 24763E-100000 AT is>
Lines: 45
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 19 Dec 1996, Eli Zaretskii wrote:
> 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. 

I've been reading through the dpmi specs and I think the following code 
should perform exactly like enable() and disable() (which only call 
__dpmi_get_and_enable_virtual_interrupt_state 
__dpmi_get_and_disable_virtual_interrupt_state respectively) --


static __inline__ int my_disable()
{
 int int_state;
 __asm__ __volatile__ ( "int $0x31"
                         : "a" (int_state)
                         : "a" (0x0900)
                         : "%eax" );
 return int_state & 1;
}


static __inline__ int my_enable()
{
 int int_state;
 __asm__ __volatile__ ( "int $0x31"
                        : "a" (int_state)
                        : "a" (0x0901)
                        : "%eax" );
 return int_state & 1;
}


The & 1 is to provide identical output as enable() and disable().  Seems 
pretty lightweight to me, at least as lightweight as the _far* functions.

Am I missing something again?

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

- Raw text -


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