Annotation of coherent/b/kernel/ldrv/setivec.c, revision 1.1

1.1     ! root        1: /* $Header: /kernel/kersrc/ldrv/RCS/setivec.c,v 1.1 92/07/17 15:27:57 bin Exp Locker: bin $ */
        !             2: /*
        !             3:  *     The  information  contained herein  is a trade secret  of INETCO
        !             4:  *     Systems, and is confidential information.   It is provided under
        !             5:  *     a license agreement,  and may be copied or disclosed  only under
        !             6:  *     the terms of that agreement.   Any reproduction or disclosure of
        !             7:  *     this  material  without  the express  written  authorization  of
        !             8:  *     INETCO Systems or persuant to the license agreement is unlawful.
        !             9:  *
        !            10:  *     Copyright (c) 1987
        !            11:  *     An unpublished work by INETCO Systems, Ltd.
        !            12:  *     All rights reserved.
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * Loadable Driver - Enable/Disable Interrupts.
        !            17:  *
        !            18:  * $Log:       setivec.c,v $
        !            19:  * Revision 1.1  92/07/17  15:27:57  bin
        !            20:  * Initial revision
        !            21:  * 
        !            22:  * Revision 1.1        88/03/24  16:31:02      src
        !            23:  * Initial revision
        !            24:  * 
        !            25:  * 87/12/03    Allan Cornish           /usr/src/sys/ldrv/setivec.c
        !            26:  * Initial version.
        !            27:  */
        !            28: #include <sys/coherent.h>
        !            29: #include <errno.h>
        !            30: #include <sys/con.h>
        !            31: #include <sys/uproc.h>
        !            32: 
        !            33: /*
        !            34:  * Interrupt entry points [within kernel] for loadable drivers.
        !            35:  */
        !            36: extern void (*ldrvint[16])();
        !            37: 
        !            38: /*
        !            39:  * Interrupt handlers [within driver] for loadable drivers.
        !            40:  *     ldrvics[n]:     Interrupt handler code segment.
        !            41:  *     ldrvipc[n]:     Interrupt handler program counter.
        !            42:  */
        !            43: extern saddr_t ldrvics[16];
        !            44: extern void  (*ldrvipc[16])();
        !            45: 
        !            46: setivec( level, func )
        !            47: int level;
        !            48: void (*func)();
        !            49: {
        !            50:        extern void Ksetivec();
        !            51:        extern saddr_t ucs;
        !            52: 
        !            53:        u.u_error = 0;
        !            54:        level &= 15;
        !            55: 
        !            56:        /*
        !            57:         * Ensure interrupt is not already in use.
        !            58:         */
        !            59:        if ( (ldrvics[level] != 0) || (ldrvipc[level] != NULL) ) {
        !            60:                u.u_error = EDBUSY;
        !            61:                return;
        !            62:        }
        !            63: 
        !            64:        /*
        !            65:         * Record interrupt function BEFORE enabling interrupt.
        !            66:         */
        !            67:        ldrvipc[level] = func;
        !            68:        ldrvics[level] = ucs;
        !            69: 
        !            70:        /*
        !            71:         * Attempt to enable interrupt.
        !            72:         */
        !            73:        kcall( Ksetivec, level, ldrvint[level] );
        !            74: 
        !            75:        /*
        !            76:         * Interrupt is in use by a resident driver.
        !            77:         */
        !            78:        if ( u.u_error ) {
        !            79:                ldrvipc[level] = NULL;
        !            80:                ldrvics[level] = 0;
        !            81:        }
        !            82: }
        !            83: 
        !            84: clrivec( level )
        !            85: register int level;
        !            86: {
        !            87:        extern void Kclrivec();
        !            88:        extern saddr_t ucs;
        !            89: 
        !            90:        level &= 15;
        !            91: 
        !            92:        /*
        !            93:         * Ensure interrupt belongs to our process.
        !            94:         */
        !            95:        if ( ldrvics[level] != ucs ) {
        !            96:                u.u_error = EPERM;
        !            97:                return;
        !            98:        }
        !            99: 
        !           100:        /*
        !           101:         * Disable interrupt.
        !           102:         */
        !           103:        kcall( Kclrivec, level );
        !           104: 
        !           105:        /*
        !           106:         * Erase interrupt function AFTER disabling interrupt.
        !           107:         */
        !           108:        ldrvipc[level] = NULL;
        !           109:        ldrvics[level] = 0;
        !           110: }

unix.superglobalmegacorp.com

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