Xref: news2.mv.net comp.os.msdos.djgpp:8635 From: snarfy AT goodnet DOT com Newsgroups: comp.os.msdos.djgpp Subject: Hand chaining interrupts. Date: 13 Sep 1996 05:29:52 GMT Organization: GoodNet Lines: 57 Message-ID: <51argg$16jm@news.goodnet.com> NNTP-Posting-Host: goodnet.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I had a question on how to chain interrupts. Is their anything special that needs to be considered? I've written all of my interrupt code in asm, and I'm setting the interrupt with the raw __dpmi set interrupt calls. It works fine, but it doesn't chain to the old handler, and after a while it crashes because the old handler needs to be called. I've tried chaining to the old handler by just jmping to it, but that blows up with random error messages. Here's some sample code. /* Code to show the syntax for jmp'ing to a function in asm */ __dpmi_paddr handler; void my_func(void) { printf("Hello\n"); exit(0); } main() { handler.offset32 = (int) my_func; handler.segment = _my_cs(); asm("jmp _handler(,1)"); /* never gets here. */ } Now I've compiled the code above and it works just as expected. WHen I try the same thing in an interrupt though, it doesn't work. Sample: /* file int.S */ _my_handler: pushal movw %cs:___djgpp_our_DS, %ds ... do some stuff .. cmpl _foo, %eax je 1f movl $20, %eax outb %al, $20 popal sti iret 1: popal jmp _old_handler(,1) This interupt code works fine until I put the chaining into it. I've traced it down to the jmp _old_handler(,1). I don't know why this doesn't work. It works fine in the first example. Is there something special I need to do? Thanks Josh snarfy AT goodnet DOT com