Annotation of researchv10dc/sys/md/mchkmfair.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Routines that deal closely with VAX-specific traps:
        !             3:  * machine checks, memory errors, and the like
        !             4:  * MicroVAX III version
        !             5:  */
        !             6: #include "sys/param.h"
        !             7: #include "sys/systm.h"
        !             8: #include "sys/user.h"
        !             9: #include "sys/mtpr.h"
        !            10: #include "sys/psl.h"
        !            11: #include "sys/qbio.h"
        !            12: 
        !            13: extern char *iospace;
        !            14: 
        !            15: /*
        !            16:  * Machine check error recovery code.
        !            17:  * Print the machine check frame and reset things.
        !            18:  * If in user mode, send a signal;
        !            19:  * if not and in kernel mode, panic.
        !            20:  */
        !            21: 
        !            22: struct mc650frame {
        !            23:        long count;
        !            24:        long code;
        !            25:        long va;
        !            26:        long state1;
        !            27:        long state2;
        !            28:        long pc;
        !            29:        long psl;
        !            30: };
        !            31: 
        !            32: #define        CANTRST 0x8000          /* state2: instruction can't restart */
        !            33: 
        !            34: #define        MCTMAX  0xa
        !            35: #define        MCTBUS  0x80
        !            36: #define        MCTBUSMAX 0x83
        !            37: 
        !            38: static char *mctype[] = {
        !            39:        "",
        !            40:        "fpa proto", "fpa resins", "fpa sts", "fpa sts",
        !            41:        "mmu", "mmu", "mmu", "mmu",
        !            42:        "intr bad ipl", "movc"
        !            43: };
        !            44: 
        !            45: static char *mcbus[] = {
        !            46:        "read", "read", "write", "write"
        !            47: };
        !            48: 
        !            49: machinecheck(ps, f)
        !            50: long ps;
        !            51: register struct mc650frame *f;
        !            52: {
        !            53:        int ok;
        !            54:        char *name;
        !            55: 
        !            56:        ok = mckrec(f);
        !            57:        if (f->code <= MCTMAX)
        !            58:                name = mctype[f->code];
        !            59:        else if (f->code >= MCTBUS && f->code <= MCTBUSMAX)
        !            60:                name = mcbus[f->code - MCTBUS];
        !            61:        else
        !            62:                name = "";
        !            63:        printf("machine check type0x%x %s va0x%x st0x%x 0x%x pc0x%x ps0x%x\n",
        !            64:                f->code, name, f->va, f->state1, f->state2, f->pc, f->psl);
        !            65:        if (ok)
        !            66:                return;         /* recovered */
        !            67:        if (USERMODE(ps)) {
        !            68:                /*
        !            69:                 * code stolen from setrun
        !            70:                 */
        !            71:                runrun++;
        !            72:                aston();
        !            73:                psignal(u.u_procp, SIGBUS);
        !            74:                return;
        !            75:        }
        !            76:        panic("mchk");
        !            77: }
        !            78: 
        !            79: /*
        !            80:  * sniff at the machine check,
        !            81:  * and decide if it's ok to recover
        !            82:  * -- memerr calls machreset; it's not worthwhile for other errors
        !            83:  * -- the hardware disables the cache if necessary
        !            84:  */
        !            85: 
        !            86: mckrec(f)
        !            87: register struct mc650frame *f;
        !            88: {
        !            89: 
        !            90:        switch (f->code) {
        !            91:        case 0x1: case 0x2: case 0x3: case 0x4:         /* fpa errors */
        !            92:                break;
        !            93: 
        !            94:        case 0x5: case 0x6: case 0x7: case 0x8:         /* mmu errors; can't recover */
        !            95:                printf("p0br %x lr %x p1br %x lr %x sbr %x lr %x\n",
        !            96:                        mfpr(P0BR), mfpr(P0LR), mfpr(P1BR), mfpr(P1LR),
        !            97:                        mfpr(SBR), mfpr(SLR));
        !            98:                return (0);
        !            99: 
        !           100:        case 0x9:                       /* interrupt at illegal ipl */
        !           101:        case 0xa:                       /* microcode error in movc */
        !           102:                return (0);
        !           103: 
        !           104:        case 0x80: case 0x81:           /* bus error on read */
        !           105:                memerr();
        !           106:                break;
        !           107: 
        !           108:        case 0x82: case 0x83:           /* bus error on write; can't recover */
        !           109:                memerr();
        !           110:                return (0);
        !           111:        }
        !           112:        /*
        !           113:         * might be able to recover
        !           114:         */
        !           115:        if (f->psl & PSL_FPD || (f->state2 & CANTRST) == 0)
        !           116:                return (1);
        !           117:        return (0);
        !           118: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.