From: "Michal Strelec" Newsgroups: comp.os.msdos.djgpp Subject: Re: RM or PM interrupts Date: Mon, 19 Apr 1999 15:19:52 +0200 Organization: Czech Technical University Lines: 66 Message-ID: <7ffaoa$l3n$1@ns.felk.cvut.cz> References: NNTP-Posting-Host: cl106161.osu.cz X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, thanks for answers. >> Suppose that my program is in protected mode and suddenly comes interrupt. >> Q1: When interrupt apears and proccesor was in PM it stay in PM? > >If it's a hardware interrupt, yes. > >> And suppose I've written PM interrupt. > >What exactly does this mean? Does this mean that your program issued a >software interrupt? > >If so, then the way software interrupts are handled depends heavily on >the DPMI server and on which interrupt did your program issue. It's >better to ask more specific questions, if you want a specific answer. > In my case it's harware interrupt from communication. So when I get it I do some input/output operation to ports (I hope it don't need any switch to RM). >> But my program >> uses reading and writting to ports (function inportsb,...). >> Q2: Are these functions only PM or it has to switch processor to RM? > >Reading ports doesn't involve a mode switch, but with some DPMI servers >these functions will cause an exception (not an interrupt) and run slower. >The exception will be caught by the DPMI server or the underlying OS >(Windows, memory manager), so it is all transparent, except that the >program runs slower. > >> Q3: Suppose these functions are PM. So my program NEVER switch to RM? > >If you never call DOS/BIOS and hook all hardware interrupts (like timer >and keyboard) with your own PM handlers, then your program is always in >PM. > >But if, for example, you leave the timer in its default state, then there >is no PM handler for it, and the CPU will switch to RM and back 18.2 times >a second, to let the BIOS handler of the timer tick interrupt do its job. >The same happens with the keyboard. In general, any hardware interrupt >whose normal handler is in the BIOS needs a mode switch, because BIOS uses >real-mode code. > Ya, time interupt always occure, but I wrote my own handler (for some reasons), where some actions are taken and then execution is passed to old (original) handler. AND THAT'S a problem because it calls BIOS function (I suppose and SWITCH to RRRMMM). QQQQQQ: Any idea how to solve it? >> Q4: Processor always gets interrupt from timer. And when my program is in PM >> and DPMI catch interrupt from timer, it switch to RM and pass to DOS >> functions, or it has its own PM alternative? > >See above. Windows 9X might have a PM handler, but otherwise you get a >mode switch. I use cwsdpmi.exe. Thanx