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