Date: Mon, 17 Feb 1997 11:16:47 +0200 (IST) From: Eli Zaretskii To: Alberto Vignani cc: djgpp AT delorie DOT com, Charles Sandmann Subject: Re: For DOSEMU users - djgpp and ^C troubles In-Reply-To: <199702162351.XAA16071@monviso.alpcom.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 16 Feb 1997, Alberto Vignani wrote: > Can someone (Eli?) enlighten me on what's going on when you press ^C? > When a djgpp program terminates normally, I see all the shutdown sequence > up to the int0x21-AX=4Cxx which signals dosemu to quit the DPMI server. > This doesn't happen with ^C; on the dosemu side, I have currently to rely > on the stack fault to understand what went on. I'm not the best person to ask about these issues, so I cc: this to Charles Sandmann who might have better insight. Please take the info below with a grain of salt, in case I confuse things. I think this is a bug in DOSEmu. It probably handles ^C specially and kills the DJGPP program before ^C ever gets to it. Because if ^C would get to your program, it will cause (almost) the same chain of events as with Ctrl-Break (which works, right?): 1) the ^C key is detected by the keyboard interrupt handler installed by the DJGPP startup code; 2) the keyboard handler invalidates the DJGPP DS selector; 3) when your program accesses any of its data, the invalid DS causes an exception; 4) the exception gets caught by the DJGPP exception processor; 5) the exception processor prints the message about SIGINT and aborts your program by calling `_exit' (or calls your SIGINT handler if you installed one); 6) `_exit' shuts down the program and eventually calls the DOS Int 21h/AH=4Ch function. [What's different about Ctrl-Break is that it generates interrupt 1Bh which is hooked by the DJGPP startup code, instead of being detected by the keyboard handler.] One thing that I would suggest testing is to install a handler for SIGINT and see if it gets called at all when you press ^C or Ctr-Break. Charles?