Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!unido!sbsvax!roeder From: roeder@sbsvax.UUCP (Edgar Roeder) Newsgroups: comp.sys.atari.st Subject: Re: Critical error handler Message-ID: <757@sbsvax.UUCP> Date: 31 May 89 18:24:30 GMT References: <26@meadow.UUCP> Organization: Universitaet des Saarlandes, Saarbruecken, W-Germany Lines: 35 In article <26@meadow.UUCP>, bill@meadow.UUCP (Bill Foster) writes: > > Is this the critical error handler vector (etv_critic = 0x404)? If I call Yes it is. > What is the format and return values for the critical error handler > routine? The routine is called with 2 arguments: - the bios error number of the event causing the handler to be called - the drive which caused this error The return value should be one of: 0L - ignore the error 0x10000L - retry (possibly this gives the same error again) any other value - return with this value as error (i.e. ABORT) You can install a normal C-routine as the error handler. But you can only call Bios-functions for terminal output, since the handler may be called from a GEMDOS-function and since GEMDOS is not reentrant (*), you can't use GEMDOS-functions like Cconout() (and most printf()'s in C-Compilers). Also make sure that your C-compiler has a reentrant bios() binding - this means that it uses a stack for the return-code from the bios()-function and eventually saved registers and not a static storage location. Otherwise you would have to use inline-assembler (like in MEGAMAX C, Laser C or GNU-C) or a seperate assembler routine to call trap #13. Hope this helps. - Edgar (*) GEMDOS is not reentrant when called by the Bios because it uses a static (and undocumented (!)) storage location for the return address when it calls a Bios-function like for example Rwabs() from inside Fwrite() which eventually calls the critical error handler.