From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: LONG: My INT31 handler isn't feeling too swell Date: 8 Apr 1999 16:40:50 GMT Organization: University of Lulea, Sweden Lines: 59 Message-ID: <7eim6i$nrb$1@news.luth.se> References: <7e7j4e$cr4$4 AT news DOT luth DOT se> <20vhfc47t7 DOT fsf AT Sky DOT inp DOT nsk DOT su> <7edsj2$agf$1 AT news DOT luth DOT se> <20aewlb2p0 DOT fsf AT Sky DOT inp DOT nsk DOT su> NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Michael Bukin (bukinm AT inp DOT nsk DOT su) wrote: : ams AT ludd DOT luth DOT se (Martin Str|mberg) writes: : > Hmm. Yes that seems like a correct diagnose. At what offset of %esp : > are the flags upon the entry of my interrupt handler (%esp+x, what is : > x)? : : You will need to calculate it yourself, for example, if you push the : following registers in stack in your interrupt handler : : push %%eax : push %%ebx : push %%ecx : : Then stack will look like this : : %flags : selector : offset : %eax : %ebx : %ecx Yes. But you missed the point where I said upon entry of my handler. Hence x = 8! Anyway I _really_ appreciate your helping comments. Another question: teh selector is 16 bits, right? But when pushed or popped stack changes by 32 bits? [Klippa, klapp, kluppit some more stack manipulations.] : BTW, you can use selector from stack to determine DPL or anything : else necessary for allocated selector (though all allocated selectors : will usually have the same DPL as your interrupt handler DPL). Hmm. What is DPL? Something Priviledge Level? So how can I determine DPL from selector? And what should I have it for? : Processor only blocks hardware interrupts (it does not pay attention : to the interrupt request line), but you can generate software : interrupts even if interrupts are disabled. I don't know restrictions : of DPMI environment (libc reference for : __dpmi_set_protected_mode_interrupt_vector says to use sti before : iret), but it is generally advisable to not enable interrupts inside : interrupt handler, because then interrupts might pile up and trash : stack. According to some documentation on i486, it is safe to do sti : right before iret, it says that processor reacts on external : interrupts after executing next instruction after sti. Aha! Thanks. Marillion, Script for a Jester's Tear, MartinS