Mail Archives: djgpp/1996/12/21/00:34:13
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 -