Annotation of coherent/f/usr/include/kernel/reg.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * /usr/include/sys/reg.h
        !             3:  *
        !             4:  * Machine dependent definitions, 80386 Coherent, IBM PC.
        !             5:  *
        !             6:  * Revised: Mon Jul 19 12:25:37 1993 CDT
        !             7:  */
        !             8: #ifndef        __KERNEL_REG_H__
        !             9: #define        __KERNEL_REG_H__
        !            10: 
        !            11: #include <common/__caddr.h>
        !            12: #include <kernel/param.h>
        !            13: 
        !            14: /*
        !            15:  * Functions.
        !            16:  * blockn - block number from byte number
        !            17:  * blocko - block offset from byte number
        !            18:  * nbnrem - offset into indirect block from block number
        !            19:  * nbndiv - residual indirect mapping from block number
        !            20:  * btocru - byte to click (saddr_t) rounding up
        !            21:  * btocrd - byte to click rounding down
        !            22:  * ctob - click to byte
        !            23:  * stod - saddr_t to daddr_t conversion for swapper.
        !            24:  */
        !            25: 
        !            26: #define        NIVEC   192
        !            27: 
        !            28: #define        blockn(n)               ((n) >> 9)
        !            29: #define        blocko(n)               ((n) & (512 - 1))
        !            30: #define nbnrem(b)              ((int) (b) & (128 - 1))
        !            31: #define nbndiv(b)              ((b) >> 7)
        !            32: 
        !            33: 
        !            34: #define        btos(n)         ((((unsigned long)(n))+(1<<BPSSHIFT)-1) >> BPSSHIFT)
        !            35: #define        btosrd(n)       (((unsigned long)(n)) >> BPSSHIFT)
        !            36: #define        stob(n)         (((long)(n)) << BPSSHIFT)
        !            37: 
        !            38: #define        btoc(n)         ((((unsigned long)(n))+NBPC-1) >> BPCSHIFT)
        !            39: #define        btocrd(n)       (((unsigned long)(n)) >> BPCSHIFT)
        !            40: #define        ctob(n)         (((long)(n)) << BPCSHIFT)
        !            41: 
        !            42: #define ctos(x)                (((x) + (1<<SG1SHIFT)-1) >> SG1SHIFT)
        !            43: #define        ctosrd(x)       ((x) >> SG1SHIFT)
        !            44: #define        stoc(x)         ((x) << SG1SHIFT)
        !            45: 
        !            46: /*
        !            47:  * These are not put on the stack, but they have slots in the table
        !            48:  * global_reg[].  These numbers are the offsets into that table.
        !            49:  */
        !            50: #define RCR0   19
        !            51: #define RCR1   20
        !            52: #define RCR2   21
        !            53: #define RCR3   22
        !            54: 
        !            55: /*
        !            56:  * How many register slots do we recognise?
        !            57:  */
        !            58: #define NUM_REG 23
        !            59: 
        !            60: /*
        !            61:  * Register structure.
        !            62:  */
        !            63: typedef union mreg_u {
        !            64:        unsigned m_reg[1];
        !            65:        unsigned m_int;
        !            66: } MREG;
        !            67: 
        !            68: /*
        !            69:  * Segmenation prototype.
        !            70:  */
        !            71: typedef struct mproto {
        !            72:        unsigned        mp_csl;
        !            73:        unsigned        mp_dsl;
        !            74:        __caddr_t       mp_svb;
        !            75:        __caddr_t       mp_svl;
        !            76: } MPROTO;
        !            77: 
        !            78: /*
        !            79:  * Set jump and return structure.
        !            80:  */
        !            81: typedef        struct menv_s {
        !            82:        int     me_di;
        !            83:        int     me_si;
        !            84:        int     mc_bx;
        !            85:        int     me_bp;
        !            86:        int     me_sp;
        !            87:        int     me_cs;
        !            88:        int     me_pc;
        !            89:        int     me_space;
        !            90: }      MENV;
        !            91: 
        !            92: /*
        !            93:  * Context structure.
        !            94:  */
        !            95: typedef        struct mcon_s {
        !            96:        int     mc_di;
        !            97:        int     mc_si;
        !            98:        int     mc_bx;
        !            99:        int     mc_bp;
        !           100:        int     mc_sp;
        !           101:        int     mc_cs;
        !           102:        int     mc_pc;
        !           103:        int     mc_space;
        !           104: }      MCON;
        !           105: 
        !           106: /*
        !           107:  * General register structure.
        !           108:  */
        !           109: typedef int MGEN[1];
        !           110: 
        !           111: /*
        !           112:  * Useful definitions.
        !           113:  */
        !           114: #define        PIC     0x20                    /* 8259 command port */
        !           115: #define        PICM    0x21                    /* 8259 mask port */
        !           116: #define        SPIC    0xA0                    /* Slave 8259 command port */
        !           117: #define        SPICM   0xA1                    /* Slave 8259 mask port */
        !           118: #define        MFTTB   0x0100                  /* Trace trap bit */
        !           119: #define        MFINT   0x0200                  /* Interupt enable */
        !           120: #define        MUERR   0x0002                  /* Location of errno */
        !           121: #define        MFCBIT  0x0001                  /* Carry bit */
        !           122: 
        !           123: #define NUM_IRQ_LEVELS         16      /* counting master & slave PIC's */
        !           124: #define LOWEST_SLAVE_IRQ       8       /* master is 0-7; slave is 8-15 */
        !           125: 
        !           126: #if    _ENABLE_STREAMS
        !           127: 
        !           128: #include <sys/types.h>
        !           129: 
        !           130: /*
        !           131:  * NIGEL: I have made some small modifications here to allow me to slot in the
        !           132:  * extensions necessary to support the DDI/DDK rational interrupt architecture.
        !           133:  *
        !           134:  * The two macros below are used by setivec () and clrivec () in "i386/md.c" to
        !           135:  * set the PIC mask values for the base level. Under the rational scheme, this
        !           136:  * also affects some global data which is used by the DDI/DDK spl... ()
        !           137:  * functions so they can safely manipulate the PIC mask registers rather than
        !           138:  * the CPU global mask bit.
        !           139:  */
        !           140: 
        !           141: __EXTERN_C_BEGIN__
        !           142: 
        !           143: void           DDI_BASE_SLAVE_MASK     __PROTO ((uchar_t _mask));
        !           144: void           DDI_BASE_MASTER_MASK    __PROTO ((uchar_t _mask));
        !           145: 
        !           146: __EXTERN_C_END__
        !           147: 
        !           148: #else  /* if ! _ENABLE_STREAMS */
        !           149: 
        !           150: #define        DDI_BASE_SLAVE_MASK(m)          outb (SPICM, m)
        !           151: #define        DDI_BASE_MASTER_MASK(m)         outb (PICM, m)
        !           152: 
        !           153: #endif /* ! _ENABLE_STREAMS */
        !           154: 
        !           155: /*
        !           156:  * Trap codes.
        !           157:  * Passed in the upper 8 bits of
        !           158:  * the "id" passed to "trap".
        !           159:  */
        !           160: #define        SIDIV   0                       /* Divide overflow */
        !           161: #define SISST  1                       /* Single step */
        !           162: #define        SINMI   2                       /* NMI (parity) */
        !           163: #define        SIBPT   3                       /* Breakpoint */
        !           164: #define        SIOVF   4                       /* Overflow */
        !           165: #define        SIBND   5                       /* Bound */
        !           166: #define        SIOP    6                       /* Invalid opcode */
        !           167: #define        SIXNP   7                       /* Processor extension not available */
        !           168: #define        SIDBL   8                       /* Double exception */
        !           169: #define        SIXS    9                       /* Processor extension segment overrun */
        !           170: #define        SITS    10                      /* Invalid task state segment */
        !           171: #define        SINP    11                      /* Segment not present */
        !           172: #define        SISS    12                      /* Stack segment overrun/not present */
        !           173: #define        SIGP    13                      /* General protection */
        !           174: #define SIPF   14                      /* Page Fault */
        !           175: #define SIFP   16                      /* Floating Point */
        !           176: #define        SISYS   32                      /* System call */
        !           177: #define        SIRAN   33                      /* Random interrupt */
        !           178: #define        SIOSYS  34                      /* System call */
        !           179: #define        SIDEV   64                      /* Device interrupt */
        !           180: 
        !           181: /*
        !           182:  * For accessing high and low words of a long.
        !           183:  */
        !           184: struct l {
        !           185:        int     l_lo;
        !           186:        int     l_hi;
        !           187: };
        !           188: 
        !           189: #endif

unix.superglobalmegacorp.com

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