From: paochen_paul AT hotmail DOT com (Paul Simon) Newsgroups: comp.os.msdos.djgpp Subject: Re: Weird mouse interrupt...Help! Date: 28 Nov 2002 04:59:25 -0800 Organization: http://groups.google.com/ Lines: 38 Message-ID: <4d62e692.0211280459.320c9535@posting.google.com> References: <4d62e692 DOT 0211271946 DOT 799e233b AT posting DOT google DOT com> <3de5adb7 DOT sandmann AT clio DOT rice DOT edu> NNTP-Posting-Host: 61.222.76.236 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1038488365 1135 127.0.0.1 (28 Nov 2002 12:59:25 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: 28 Nov 2002 12:59:25 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Charles Sandmann wrote in message news:<3de5adb7 DOT sandmann AT clio DOT rice DOT edu>... > > 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. > > > hardware_int_handler() > > { > > INTERRUPT_ENTER(); ^^^^^^^^^^^^^ This is *wrong*, please Do *NOT* to use disable() or "sti" > > > //your handler code here. > > > INTERRUPT_LEAVE_BOTH(); ^^^^^^^^^^^^^^ This is *wrong*, please Do *NOT* to use enable() or "cli" > > } > > This is wrong; do not use the sti/cli Thanks for Charles!! Yes! I used DJGPP wrappers to insatll my handler. as this ... _go32_dpmi_get_protected_mode_interrupt_vector(intr_vector, &oldirq); newirq.pm_offset = (int)hardware_int_handler; //my H/W handler newirq.pm_selector = _go32_my_cs(); _go32_dpmi_allocate_iret_wrapper(&newirq); //DJGPP wrapper. ... In my handler, I remove INTERRUPT_ENTER() and INTERRUPT_LEAVE_BOTH() as Charles said. And my program work fine(when mouse interrupt or my H/W interrut occurred), my system never crashed! I try many times. Thanks for Charles again!!