Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!decwrl!labrea!agate!pasteur!ames!elroy!cit-vax!ucla-cs!wales From: wales@CS.UCLA.EDU Newsgroups: comp.sys.ibm.pc Subject: Re: MS-DOS interrupt chaining question (FOLLOWUP) Message-ID: <9507@shemp.CS.UCLA.EDU> Date: 17 Feb 88 06:29:59 GMT References: <11223@shemp.UCLA.EDU> Sender: news@CS.UCLA.EDU Reply-To: wales@CS.UCLA.EDU (Rich Wales) Organization: UCLA CS Department, Los Angeles Lines: 39 About a week ago, I posed a problem involving a subroutine package that needed to chain part of itself to the hardware clock interrupt. I wanted to ensure, if possible, that the subroutine's interrupt handler would always get unchained, without forcing the user of the package to do anything special. The subroutine package is written in Turbo C. Most of my problem was solved when one person pointed out to me that Turbo C has an "atexit" library call, which can enqueue a routine to be performed upon normal exit from a program. So, I now use "atexit" in the initialization phase of my package -- to enqueue a routine to unchain my special clock handler. This, of course, does not take care of abnormal terminations. Another person offered me a subroutine package of his own which would install and deinstall generalized clock handler routines; his solution was to use his own "ctrlbrk" routine and require the user of his code to avoid "ctrlbrk" in favor of a new call supplied as part of the package. Someone else suggested that I chain into interrupt vector 22H, which points to the "termination" address to be given control when the pro- cess terminates (no matter *how* it terminates -- as long as the system remains coherent!). Problem is, as far as I can tell, that the value of the Int 22H vector is saved away before execution starts, and then restored on exit -- so that anything the program does to that vector is meaningless. If anyone out there has any actual experience in fiddling with the Int 22H vector, I would like to hear the details. So, that's where things stand for the moment. If anyone knows of a way I can be guaranteed of grabbing control during an *abnormal* termination -- whether via "abort", "_exit" (as opposed to "exit"), or an uncaught control-break interrupt -- in order to unchain an interrupt handler, I would very much like to hear from you. -- Rich Wales // UCLA Computer Science Department // +1 (213) 825-5683 3531 Boelter Hall // Los Angeles, California 90024-1596 // USA wales@CS.UCLA.EDU ...!(ucbvax,rutgers)!ucla-cs!wales "Sir, there is a multilegged creature crawling on your shoulder."