Commit | Line | Data |
---|---|---|
80992c50 KB |
1 | /*- |
2 | * Copyright (c) 1982, 1986 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.proprietary.c% | |
da7c5cc6 | 6 | * |
516f701a | 7 | * @(#)param.h 7.22 (Berkeley) %G% |
da7c5cc6 | 8 | */ |
4c542963 SL |
9 | |
10 | /* | |
9487ea54 | 11 | * Machine dependent constants for VAX. |
4c542963 | 12 | */ |
49c8d125 KB |
13 | #define MACHINE "vax" |
14 | ||
e7d5dea8 | 15 | /* |
bc2f18e8 KB |
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. | |
e7d5dea8 | 19 | */ |
516f701a KB |
20 | #define ALIGNBYTES 3 |
21 | #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) | |
e7d5dea8 | 22 | |
58b14b46 MK |
23 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
24 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) | |
25 | ||
5e09dfcf MK |
26 | #define NBPG 512 /* bytes/page */ |
27 | #define PGOFSET (NBPG-1) /* byte offset into page */ | |
28 | #define PGSHIFT 9 /* LOG2(NBPG) */ | |
29 | #define NPTEPG (NBPG/(sizeof (struct pte))) | |
30 | ||
9487ea54 | 31 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
2ecce9fd | 32 | #define KERNTEXTOFF KERNBASE /* start of kernel text */ |
9487ea54 KB |
33 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) |
34 | ||
dd94cc44 | 35 | #ifndef SECSIZE |
5e09dfcf MK |
36 | #define DEV_BSIZE 512 |
37 | #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
38 | #define BLKDEV_IOSIZE 2048 | |
58b14b46 | 39 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ |
dd94cc44 MK |
40 | #else SECSIZE |
41 | /* | |
42 | * Devices without disk labels and the swap virtual device | |
43 | * use "blocks" of exactly pagesize. Devices with disk labels | |
44 | * use device-dependent sector sizes for block and character interfaces. | |
45 | */ | |
46 | #define DEV_BSIZE NBPG | |
47 | #define DEV_BSHIFT PGSHIFT /* log2(DEV_BSIZE) */ | |
48 | #define BLKDEV_IOSIZE NBPG /* NBPG for unlabeled block devices */ | |
49 | #endif SECSIZE | |
50 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ | |
4c542963 SL |
51 | |
52 | #define CLSIZE 2 | |
53 | #define CLSIZELOG2 1 | |
54 | ||
efa8b34c | 55 | /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ |
5e09dfcf MK |
56 | #define SSIZE 4 /* initial stack size/NBPG */ |
57 | #define SINCR 4 /* increment of stack/NBPG */ | |
4c542963 | 58 | |
3697b9ee | 59 | #define UPAGES 16 /* pages of u-area */ |
4c542963 | 60 | |
d58c675e MK |
61 | /* |
62 | * Constants related to network buffer management. | |
63 | * MCLBYTES must be no larger than CLBYTES (the software page size), and, | |
64 | * on machines that exchange pages of input or output buffers with mbuf | |
65 | * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple | |
66 | * of the hardware page size. | |
67 | */ | |
68 | #define MSIZE 128 /* size of an mbuf */ | |
69 | #define MAPPED_MBUFS /* can do scatter-gather I/O */ | |
70 | #if CLBYTES > 1024 | |
71 | #define MCLBYTES 1024 | |
72 | #define MCLSHIFT 10 | |
73 | #define MCLOFSET (MCLBYTES - 1) | |
74 | #else | |
75 | #define MCLBYTES CLBYTES | |
76 | #define MCLSHIFT CLSHIFT | |
77 | #define MCLOFSET CLOFSET | |
78 | #endif | |
79 | #ifdef GATEWAY | |
80 | #define NMBCLUSTERS 512 /* map size, max cluster allocation */ | |
81 | #else | |
82 | #define NMBCLUSTERS 256 /* map size, max cluster allocation */ | |
83 | #endif | |
84 | ||
a2b92cf4 KM |
85 | /* |
86 | * Size of kernel malloc arena in CLBYTES-sized logical pages | |
87 | */ | |
88 | #ifndef NKMEMCLUSTERS | |
89 | #define NKMEMCLUSTERS (512*1024/CLBYTES) | |
90 | #endif | |
91 | ||
4c542963 SL |
92 | /* |
93 | * Some macros for units conversion | |
94 | */ | |
95 | /* Core clicks (512 bytes) to segments and vice versa */ | |
96 | #define ctos(x) (x) | |
97 | #define stoc(x) (x) | |
98 | ||
dd94cc44 | 99 | #ifndef SECSIZE |
4c542963 SL |
100 | /* Core clicks (512 bytes) to disk blocks */ |
101 | #define ctod(x) (x) | |
102 | #define dtoc(x) (x) | |
dd94cc44 MK |
103 | #define dtob(x) ((x)<<PGSHIFT) |
104 | #else SECSIZE | |
105 | /* Core clicks (512 bytes) to disk blocks; deprecated */ | |
106 | #define ctod(x) (x) /* XXX */ | |
107 | #define dtoc(x) (x) /* XXX */ | |
108 | #define dtob(x) ((x)<<PGSHIFT) /* XXX */ | |
109 | #endif SECSIZE | |
4c542963 SL |
110 | |
111 | /* clicks to bytes */ | |
112 | #define ctob(x) ((x)<<9) | |
113 | ||
114 | /* bytes to clicks */ | |
115 | #define btoc(x) ((((unsigned)(x)+511)>>9)) | |
116 | ||
dd94cc44 | 117 | #ifndef SECSIZE |
5e09dfcf MK |
118 | #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ |
119 | ((unsigned)(bytes) >> DEV_BSHIFT) | |
120 | #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ | |
121 | ((unsigned)(db) << DEV_BSHIFT) | |
122 | ||
123 | /* | |
124 | * Map a ``block device block'' to a file system block. | |
125 | * This should be device dependent, and will be if we | |
126 | * add an entry to cdevsw/bdevsw for that purpose. | |
127 | * For now though just use DEV_BSIZE. | |
128 | */ | |
129 | #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) | |
dd94cc44 MK |
130 | #else SECSIZE |
131 | /* bytes to "disk blocks" and back; deprecated */ | |
132 | #define btodb(bytes) ((unsigned)(bytes) >> DEV_BSHIFT) /* XXX */ | |
133 | #define dbtob(db) ((unsigned)(db) << DEV_BSHIFT) /* XXX */ | |
134 | #endif SECSIZE | |
5e09dfcf | 135 | |
4c542963 SL |
136 | /* |
137 | * Macros to decode processor status word. | |
138 | */ | |
139 | #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) | |
8664db0b | 140 | #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) |
4c542963 | 141 | |
3327052b MK |
142 | #ifdef KERNEL |
143 | #ifndef LOCORE | |
144 | int cpuspeed; | |
3327052b | 145 | #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } |
837583eb | 146 | #endif |
3327052b | 147 | |
ffbc6a8d | 148 | #else |
4c542963 | 149 | #define DELAY(n) { register int N = (n); while (--N > 0); } |
ffbc6a8d | 150 | #endif |