www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/17/04:41:13

Date: Mon, 17 Feb 1997 11:16:47 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Alberto Vignani <alberto DOT vignani AT torino DOT alpcom DOT it>
cc: djgpp AT delorie DOT com, Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Subject: Re: For DOSEMU users - djgpp and ^C troubles
In-Reply-To: <199702162351.XAA16071@monviso.alpcom.it>
Message-ID: <Pine.SUN.3.91.970217111554.17765D-100000@is>
MIME-Version: 1.0

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?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019