Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!mit-eddie!nathan
From: nathan@eddie.MIT.EDU (Nathan Glasser)
Newsgroups: comp.sys.ibm.pc
Subject: Re: DOS Critical-error handler
Message-ID: <6381@eddie.MIT.EDU>
Date: Sat, 25-Jul-87 05:31:58 EDT
Article-I.D.: eddie.6381
Posted: Sat Jul 25 05:31:58 1987
Date-Received: Sat, 25-Jul-87 21:36:14 EDT
References: <1871@isis.UUCP> <1610020@hpcvlo.HP.COM> <872@bsu-cs.UUCP>
Reply-To: nathan@eddie.MIT.EDU (Nathan Glasser)
Organization: MIT, EE/CS Computer Facilities, Cambridge, MA
Lines: 36

In article <872@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes:
>The code fragment provided in the quoted article directly manipulates
>the interrupt vectors in low memory.  Please don't do this.  But if you
>must, please don't ask others to do this!  User applications have no
>business bypassing the standard operating system-provided interfaces.
>MS-DOS provides system calls that let you change the address of the
>critical error handler.  These should be used.

True, there are Dos system calls to do this, but the interrupt vectors
have nothing to do with Dos. They are hardware (8086/8088/80286) specific.
You referred to the Dos methed as "the standard operating system-provided
interfaces," whereas it is not really the case.

Maybe if Dos were written better, and if nobody ever did anything
with the bios or hardware directly, people wouldn't have started doing
this. There are many things a programmer might want to do which are
supported, say, by the bios, for which Dos provides no interface. The
interrupt vectors are one area where Dos does provide an interface.
But since everybody knows that all it does is turn off interrupts (cli)
do the same mov instructions as given in the critical handler
article, and turn them back on (sti), and it is more efficient
to do this directly than doing the Dos function call, people just
do it directly.

In addition, one fact which people don't usually have to think
about but is sometimes important is that some/all? calls to Dos
functions turn on interrupts (sti) at some point before doing
whatever it is they're supposed to do. If your program needs
to leave interrupts turned off for a period of time during which
we also want to set a vector, you can't use the Dos function call.
(I ran into this the other day. It was really tough to find.)
-- 
				Nathan Glasser
				nathan@mit-eddie.uucp (usenet)
fnord				nathan@xx.lcs.mit.edu (arpa)
"A tribble is the only love that money can buy."