From: "Anthony Q. Bachler" Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP gurus: interrupts wrappers are reentrant ? Date: 21 Mar 1997 21:59:11 GMT Organization: Apcad Engineering Lines: 69 Message-ID: <01bc3638$070ea500$LocalHost@anthonyb> References: <199703211327 DOT OAA21219 AT math DOT amu DOT edu DOT pl> NNTP-Posting-Host: 208.16.64.202 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I have now noticed this behavior in ISR's. I am getting an error in my program that causes a fault when the ISR is entered for the second time. It works fine the first time and updates the variable "volatile long time; ", but when it tries to do it again 55ms later, it comes up as an invalid instruction or a segment violation (SETSEGV). -- ::-) ---------------------------------------------------------------------------- --- HTTP://vax2.rainis.net/~cwhizard/norn.htm Home of the Sixpak of Norns. To reply to a news posting, remove the anti-SPAM features from my e-mail address. Mark Habersack wrote in article <199703211327 DOT OAA21219 AT math DOT amu DOT edu DOT pl>... > Once upon a time (on 20 Mar 97 at 14:55) Anthony Q. Bachler said: > > > Try clearing the interupt enable bit of the MSW as one of the first steps in > > the ISR. This will cause the hardware to store any interupts that occur and > > execute them when you reenable them. To disable them use the CLI assembly > > instruction. To reenable them use the STI instruction. A word of caution, > > STI should be immediately followed by an IRET to prevent the problem you are > > experienceing. The problem you are having is that the stack is being > > corrupted. When you perform an STI, the processor should hold off executing > > any pending interupts until after the next command. I know for a fact that > > it works this way on the 8086-80686. On a different processor, it may work > > differently. The above details are for the intel CPU's, but the method is > > the same for most others. > This won't work under many DPMI servers (as well as under many, perhaps all, > multitasking environments - WinNT, Linux/DOSEMU, OS/2, OpenDOS MultiTasker) - > they virtualize the interrupts and STI & CLI instructions are emulated by the > underlying software. They have effect only on the current application/VM. > Several days ago I've posted to this newsgroup a short proggy which makes the > interrupts reentrant. Subject: line of the thread had an ISR string in it - > browse mail archives on http://www.delorie.com/djgpp/ and you should be able > to find the message. If not then e-mail me privately and I'll send you the > code. > > ---------- Visit http://ananke.amu.edu.pl/~grendel ------------ > You're just a waste of time, you're just a babbling face, you're > just three sick holes that run like sores, you're fucking waste > you're like a slug on the floor, oh you're usless and ugly and > useless and ugly, and shiver and shake when I think of how you > make me hate. >