mirror of
https://github.com/ctm/syn68k.git
synced 2024-12-01 00:51:19 +00:00
49 lines
927 B
C
49 lines
927 B
C
#ifdef MSDOS
|
|
|
|
#include "syn68k_private.h"
|
|
|
|
#ifndef SYNCHRONOUS_INTERRUPTS
|
|
|
|
int
|
|
dos_block_interrupts ()
|
|
{
|
|
unsigned long iflag;
|
|
asm ("pushfl\n\t" /* We save the old eflags, which has interrupt mask bit. */
|
|
"popl %0\n\t"
|
|
"shrl $9,%0\n\t"
|
|
"andl $1,%0\n\t"
|
|
"jz 1f\n\t" /* Avoid CLI overhead under DPMI. */
|
|
"cli\n"
|
|
"1:"
|
|
: "=r" (iflag)
|
|
: : "cc");
|
|
return iflag;
|
|
}
|
|
|
|
|
|
void
|
|
dos_restore_interrupts (int onoff)
|
|
{
|
|
unsigned long current_iflag;
|
|
|
|
asm ("pushfl\n\t" /* We save the old eflags, which has interrupt mask bit. */
|
|
"popl %0\n\t"
|
|
"shrl $9,%0\n\t"
|
|
"andl $1,%0"
|
|
: "=r" (current_iflag)
|
|
: : "cc");
|
|
|
|
if (onoff != current_iflag)
|
|
{
|
|
/* Only execute these when necessary, to avoid DPMI overhead. */
|
|
if (onoff)
|
|
asm ("sti");
|
|
else
|
|
asm ("cli");
|
|
}
|
|
}
|
|
|
|
#endif /* !SYNCHRONOUS_INTERRUPTS */
|
|
|
|
#endif /* MSDOS */
|