Newsgroups: comp.os.msdos.djgpp From: Peter Berdeklis Subject: Re: Question about hardware interrupts... Message-ID: Nntp-Posting-Host: chinook.physics.utoronto.ca Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: University of Toronto - Dept. of Physics In-Reply-To: Date: Fri, 20 Dec 1996 19:46:51 GMT References: 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