From: Regis BOSSUT Newsgroups: comp.os.msdos.djgpp Subject: [BUG] Total crash under MS-DOS when using itimer + workaround Date: Mon, 13 Oct 1997 12:03:57 +0200 Organization: IEMN - Dépt ISEN - Acoustique Lines: 36 Message-ID: <3441F20D.4F8D@isen.fr> NNTP-Posting-Host: hpac1.isen.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi all ! I've been spending two days trying to figure out why my small program was crashing my PC. Here is the context : - A program allocating a much memory via malloc, - using signal(SIGALARM,timeout), - using setitimer() for a recurrent 2 second interrupt, - doing some disk and screen I/O. Under a DOS box in Win95, the program works fine. Under MSDOS 7.00, the program works fine, up to the end. Just before being prompted for a new command, I get a General Protection Fault in RMCB with error 0xa4 (I don't have a list of errors...) Use of fsdb or gdb is not of any help (same type of crash). Allocating less memory made the program work some times. After a two day brainstorming, I thought about a timer HW interrupt not being serviced correctly, so I added a setitimer() to disable the timer just before exiting, by means of atexit(). Now the program works fine ! By carefully checking the source code about timers and exit routines, I discovered that the timer HW int. is not disabled before exiting. This should be done around keyboard and cbrk HW ints. disabling, in go32/dpmiexcp.c. I'm not DPMI aware enough to add this functionality, but I'm sure that it would not be difficult for the author(s) to correct this. Also, I have a workaround... Hope this will contribute to DJGPP performance. /Régis