From: "Romano Signorelli" Newsgroups: alt.msdos.programmer,comp.os.msdos.djgpp,comp.os.msdos.programmer Subject: IRQ trap with stack change, very intersting! Date: 30 Jun 1997 12:32:22 GMT Organization: Gefran s.p.a. Lines: 46 Message-ID: <01bc8552$054435a0$6f02a8c0@uiemurs.gefran.it> NNTP-Posting-Host: uiemurs.gefran.it To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi, i'm using Borland C++ 4.52 with DOS powerpack which provide DPMI16 and DPMI32 support. I'm trying to trap IRQ 10 (interrupt 0x71), also IRQ 8 (interrupt 0x1c). I want to write a dual-task program. Each time the interrupt come, i want to do a stack switch (íve provided 2 separated stacks, allocated at start-time), save the registers, change the return CS:IP in the stack to point to the next task and, then, do an IRET. Here are some source code (simplified for debugging purposes): -- Start code: InitCode(); #ifdef DEBUG_VERSION geninterrupt(0x71); #endif do{ while(1==1); -- Task1 code: do{ task1_counter++; #ifdef DEBUG_VERSION geninterrupt(0x71); #endif } while (1==1); -- Task2 code: do{ task2_counter++; #ifdef DEBUG_VERSION geninterrupt(0x71); #endif }while (1==1); With DEBUG_VERSION defined, my INT routine works well, it does a correct stack switch and the 2 tasks take 50% CPU time each. The problem comes when i try to install my INT routine over an hardware interrupt (my IRQ 10 or the PC's IRQ 8). The stack isn't my program stack (i think it is the DPMI server INT stack) and i cannot find the correct return CS:IP in it. Please HELP ME!!! Thanks in advance, bye. Note: please don't flame with messages like "Why don't you use OS/2" or similar. I have to do it in pure DOS. Thanks.