From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: Weird mouse interrupt...Help! Date: Wed, 27 Nov 2002 23:46:31 CST Organization: Rice University, Houston TX Lines: 36 Message-ID: <3de5adb7.sandmann@clio.rice.edu> References: <4d62e692 DOT 0211271946 DOT 799e233b AT posting DOT google DOT com> NNTP-Posting-Host: clio.rice.edu X-Trace: joe.rice.edu 1038462545 2182 128.42.105.3 (28 Nov 2002 05:49:05 GMT) X-Complaints-To: abuse AT rice DOT edu NNTP-Posting-Date: 28 Nov 2002 05:49:05 GMT X-NewsEditor: ED-1.5.9 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > 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