Annotation of 43BSDReno/sys/vax/machparam.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)machparam.h 7.16 (Berkeley) 5/10/90
        !             7:  */
        !             8: 
        !             9: /*
        !            10:  * Machine dependent constants for VAX.
        !            11:  */
        !            12: #define        MACHINE "vax"
        !            13: 
        !            14: #ifndef BYTE_ORDER
        !            15: #include <machine/endian.h>
        !            16: #endif
        !            17: 
        !            18: #include <machine/machlimits.h>
        !            19: 
        !            20: /*
        !            21:  * Round p (pointer or byte index) up to a correctly-aligned value
        !            22:  * for all data types (int, long, ...).   The result is u_int and
        !            23:  * must be cast to any desired pointer type.
        !            24:  */
        !            25: #define        ALIGN(p)        (((u_int)(p) + (sizeof(int) - 1)) &~ (sizeof(int) - 1))
        !            26: 
        !            27: #define        NBPG            512             /* bytes/page */
        !            28: #define        PGOFSET         (NBPG-1)        /* byte offset into page */
        !            29: #define        PGSHIFT         9               /* LOG2(NBPG) */
        !            30: #define        NPTEPG          (NBPG/(sizeof (struct pte)))
        !            31: 
        !            32: #define        KERNBASE        0x80000000      /* start of kernel virtual */
        !            33: #define        KERNTEXTOFF     KERNBASE        /* start of kernel text */
        !            34: #define        BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
        !            35: 
        !            36: #define        DEV_BSIZE       512
        !            37: #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
        !            38: #define BLKDEV_IOSIZE  2048
        !            39: #define        MAXPHYS         (63 * 1024)     /* max raw I/O transfer size */
        !            40: 
        !            41: #define        CLSIZE          2
        !            42: #define        CLSIZELOG2      1
        !            43: 
        !            44: #define        SSIZE           4               /* initial stack size/NBPG */
        !            45: #define        SINCR           4               /* increment of stack/NBPG */
        !            46: 
        !            47: #define        UPAGES          16              /* pages of u-area */
        !            48: 
        !            49: /*
        !            50:  * Constants related to network buffer management.
        !            51:  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
        !            52:  * on machines that exchange pages of input or output buffers with mbuf
        !            53:  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
        !            54:  * of the hardware page size.
        !            55:  */
        !            56: #define        MSIZE           128             /* size of an mbuf */
        !            57: #define        MAPPED_MBUFS                    /* can do scatter-gather I/O */
        !            58: #if CLBYTES > 1024
        !            59: #define        MCLBYTES        1024
        !            60: #define        MCLSHIFT        10
        !            61: #define        MCLOFSET        (MCLBYTES - 1)
        !            62: #else
        !            63: #define        MCLBYTES        CLBYTES
        !            64: #define        MCLSHIFT        CLSHIFT
        !            65: #define        MCLOFSET        CLOFSET
        !            66: #endif
        !            67: #ifdef GATEWAY
        !            68: #define        NMBCLUSTERS     512             /* map size, max cluster allocation */
        !            69: #else
        !            70: #define        NMBCLUSTERS     256             /* map size, max cluster allocation */
        !            71: #endif
        !            72: 
        !            73: /*
        !            74:  * Size of kernel malloc arena in CLBYTES-sized logical pages
        !            75:  */ 
        !            76: #ifndef NKMEMCLUSTERS
        !            77: #define        NKMEMCLUSTERS   (512*1024/CLBYTES)
        !            78: #endif
        !            79: 
        !            80: /*
        !            81:  * Some macros for units conversion
        !            82:  */
        !            83: /* Core clicks (512 bytes) to segments and vice versa */
        !            84: #define        ctos(x) (x)
        !            85: #define        stoc(x) (x)
        !            86: 
        !            87: /* Core clicks (512 bytes) to disk blocks */
        !            88: #define        ctod(x) (x)
        !            89: #define        dtoc(x) (x)
        !            90: #define        dtob(x) ((x)<<PGSHIFT)
        !            91: 
        !            92: /* clicks to bytes */
        !            93: #define        ctob(x) ((x)<<9)
        !            94: 
        !            95: /* bytes to clicks */
        !            96: #define        btoc(x) ((((unsigned)(x)+511)>>9))
        !            97: 
        !            98: #define        btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
        !            99:        ((unsigned)(bytes) >> DEV_BSHIFT)
        !           100: #define        dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
        !           101:        ((unsigned)(db) << DEV_BSHIFT)
        !           102: 
        !           103: /*
        !           104:  * Map a ``block device block'' to a file system block.
        !           105:  * This should be device dependent, and will be if we
        !           106:  * add an entry to cdevsw/bdevsw for that purpose.
        !           107:  * For now though just use DEV_BSIZE.
        !           108:  */
        !           109: #define        bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
        !           110: 
        !           111: /*
        !           112:  * Macros to decode processor status word.
        !           113:  */
        !           114: #define        USERMODE(ps)    (((ps) & PSL_CURMOD) == PSL_CURMOD)
        !           115: #define        BASEPRI(ps)     (((ps) & PSL_IPL) == 0)
        !           116: 
        !           117: #ifdef KERNEL
        !           118: #ifndef LOCORE
        !           119: int    cpuspeed;
        !           120: #define        DELAY(n)        { register int N = cpuspeed * (n); while (--N > 0); }
        !           121: #endif
        !           122: 
        !           123: #else KERNEL
        !           124: #define        DELAY(n)        { register int N = (n); while (--N > 0); }
        !           125: #endif KERNEL

unix.superglobalmegacorp.com

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