[mod.computers.vax] catching machine check exceptions

GKN%OAK.SAINET.MFENET@LLL-MFE.ARPA (02/24/86)

From:    <GKN%OAK.SAINET.MFENET@LLL-MFE.Arpa>   (Gerard K. Newman)
Date:    Mon, 24-FEB-1986 08:32 EST
To:      Info-VAX@SRI-KL.Arpa
Message-ID: <[OAK.SAINET.MFENET].070DC000.008EB05A.GKN>
US-Mail:   Science Applications;  P.O. Box 2501;  Oak Ridge, TN  37831
Telephone: (615) 482-9031 x293
X-VMS-Mail-To: INFO_VAX

        From:   Arpa%"rick@NGP.UTEXAS.EDU" 15-FEB-1986 18:20
        Subj:   Catching machine check exceptions in a driver

        I am writing a device driver for a somewhat nasty device, in that when
        the device is busy, it does not respond to bus requests for the CSR.
        This causes a machine check on a Microvax II.  When things work
        correctly, you are supposed to "know" when the CSR is unavailable, but
        there are problems with timeout conditions.  Anyway, I would like to
        cheat and intercept the machine check exception just long enough to test
        the CSR and see if it is there.  Does anyone happen to know how to do
        this?

Are you looking to intercept machine checks forever, or just for a given
sequence of instructions?  If it's only for a given sequence of instructions,
you can embed the routine between a $PRTCTINI and a $PRTCTEND.  Please note
that the sequence of instructions embedded between these two macros will
execute at IPL 31 (IPL$_POWER).  When you reach the instruction following the
$PRTCTEND, R0<0> := 0 indicates that a machine check occurred.  You also must
specify the variety of machine checks you wish to be immune from.  You supply
a mask value for the second argument of $PRTCTINI which describes which
machine checks to ignore.  The bits for this mask are defined in $MCHKDEF.

See fiche 374, panels G9 and I9 if you're interested in the nitty gritty.


        $PRTCTINI       NO_MCHK,#<MCHK$M_UBA>   ;Don't bother with UBA exceptions

        .                                       ;Do your stuff
        .                                       ; in here which
        .                                       ;  might cause a machine check

        $PRTCTEND       NO_MCHK                 ;Done with protected code.
        BLBC    R0,OOPS                         ;Rats!


Hope this is what you want.

gkn

rick@NGP.UTEXAS.EDU (Rick Watson) (02/25/86)

Great, thanks!  I knew there must be a "legal" way to do this. This 
is just what I need to do.

Rick Watson
University of Texas Computation Center
 arpa:   rick@ngp.UTEXAS.EDU   rick@ngp.ARPA
 uucp:   ...seismo!ut-sally!ut-ngp!rick   rick@ut-ngp.UUCP
 bitnet: ccaw001@utadnx
 phone:  512/471-3241