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