Mail Archives: djgpp/2002/11/28/01:02:13
> When I replaced the source code disable() and enable() by
> ("sti") and ("cli") in my H/W interrupt handler, then system
> never been hung, they work fine both with PS/2 mouse and
> COM port mouse. So I think my problem has been solved! but I don't know why?
Do *NOT* put an enable() call in your handler if you are using the
DJGPP wrappers. Do *NOT* put a "sti" either. The wrappers are
not re-entrant, and they restore interrupts on exit.
> -----Here is the snippet code captured from comp.os.msdos.djgpp-----
> #define INTERRUPT_ENTER(); asm("sti"); /* enable maskable interrupts*/
> #define INTERRUPT_LEAVE(); asm("cli"); /* disable maskable interrupts*/\
> outportb (0x20, 0x20); /* End of interrupt */
> #define INTERRUPT_LEAVE_BOTH(); asm ("cli"); /* disable maskable interrupts */ \
> outportb (0x20, 0x20); /* End ofinterrupt */ \
> outportb (0xA0, 0x20); /* End ofinterrupt */
> hardware_int_handler()
> {
> INTERRUPT_ENTER();
> //your handler code here.
> INTERRUPT_LEAVE_BOTH();
> }
This is wrong; do not use the sti/cli
- Raw text -