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

From: a DOT vignani AT crf DOT it
Date: Mon, 17 Feb 1997 17:52:19 +0100
Subject: Re: For DOSEMU users - djgpp and ^C troubles
Apparently-to: djgpp AT delorie DOT com
To: djgpp AT delorie DOT com
Message-id: <01IFJ51UV6J6APTK95@CRF.IT>

On Mon, 17 Feb 1997 Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> 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.
>

Many thanks for your suggestions!

>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?):
>
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;
>
This is what I see. There is a SetSegmentLimit(0xcf,0xfff) as soon as
^C is written in the BIOS keyboard buffer, and since ds=es=ss=0xcf this
is the cause of the stack fault.

>	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);
>
Hmmm... I installed a SIGINT handler, and what I see is that after the
1st exception there is now another SetSegmentLimit (0xcf,0x5ffff);
after that, my handler is called. It then calls _exit, and all works fine.

Maybe the client code is killed before it gets a chance to change the
segment limits again; as a result, in the 'normal' case, _exit doesn't
get called.
This bug is of course not self-evident (timing?), needs some digging
into the dosemu code :(

And BTW the patch I proposed seems to have side effects on the DOS timer :(

Alberto


- Raw text -


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