Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
5eb07204 | 6 | * @(#)param.h 7.10 (Berkeley) %G% |
da7c5cc6 | 7 | */ |
4c542963 SL |
8 | |
9 | /* | |
9487ea54 | 10 | * Machine dependent constants for VAX. |
4c542963 | 11 | */ |
49c8d125 KB |
12 | #define MACHINE "vax" |
13 | ||
5eb07204 | 14 | #ifndef BYTE_ORDER |
9487ea54 KB |
15 | #include <machine/endian.h> |
16 | #endif | |
17 | ||
153bfc58 KB |
18 | #define CHAR_BIT NBBY |
19 | #define CHAR_MAX 0x7f | |
20 | #define CHAR_MIN 0x80 | |
9487ea54 | 21 | #define CLK_TCK 60 /* for times() */ |
153bfc58 KB |
22 | #define INT_MAX 0x7fffffff |
23 | #define INT_MIN 0x80000000 | |
24 | #define LONG_MAX 0x7fffffff | |
25 | #define LONG_MIN 0x80000000 | |
26 | #define SCHAR_MAX 0x7f | |
27 | #define SCHAR_MIN 0x80 | |
28 | #define SHRT_MAX 0x7fff | |
29 | #define SHRT_MIN 0x8000 | |
30 | #define UCHAR_MAX 0xff | |
31 | #define UINT_MAX 0xffffffff | |
32 | #define ULONG_MAX 0xffffffff | |
33 | #define USHRT_MAX 0xffff | |
34 | ||
58b14b46 MK |
35 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
36 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) | |
37 | ||
5e09dfcf MK |
38 | #define NBPG 512 /* bytes/page */ |
39 | #define PGOFSET (NBPG-1) /* byte offset into page */ | |
40 | #define PGSHIFT 9 /* LOG2(NBPG) */ | |
41 | #define NPTEPG (NBPG/(sizeof (struct pte))) | |
42 | ||
9487ea54 KB |
43 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
44 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) | |
45 | ||
dd94cc44 | 46 | #ifndef SECSIZE |
5e09dfcf MK |
47 | #define DEV_BSIZE 512 |
48 | #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
49 | #define BLKDEV_IOSIZE 2048 | |
58b14b46 | 50 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ |
dd94cc44 MK |
51 | #else SECSIZE |
52 | /* | |
53 | * Devices without disk labels and the swap virtual device | |
54 | * use "blocks" of exactly pagesize. Devices with disk labels | |
55 | * use device-dependent sector sizes for block and character interfaces. | |
56 | */ | |
57 | #define DEV_BSIZE NBPG | |
58 | #define DEV_BSHIFT PGSHIFT /* log2(DEV_BSIZE) */ | |
59 | #define BLKDEV_IOSIZE NBPG /* NBPG for unlabeled block devices */ | |
60 | #endif SECSIZE | |
61 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ | |
4c542963 SL |
62 | |
63 | #define CLSIZE 2 | |
64 | #define CLSIZELOG2 1 | |
65 | ||
5e09dfcf MK |
66 | #define SSIZE 4 /* initial stack size/NBPG */ |
67 | #define SINCR 4 /* increment of stack/NBPG */ | |
4c542963 | 68 | |
5e09dfcf | 69 | #define UPAGES 10 /* pages of u-area */ |
4c542963 SL |
70 | |
71 | /* | |
72 | * Some macros for units conversion | |
73 | */ | |
74 | /* Core clicks (512 bytes) to segments and vice versa */ | |
75 | #define ctos(x) (x) | |
76 | #define stoc(x) (x) | |
77 | ||
dd94cc44 | 78 | #ifndef SECSIZE |
4c542963 SL |
79 | /* Core clicks (512 bytes) to disk blocks */ |
80 | #define ctod(x) (x) | |
81 | #define dtoc(x) (x) | |
dd94cc44 MK |
82 | #define dtob(x) ((x)<<PGSHIFT) |
83 | #else SECSIZE | |
84 | /* Core clicks (512 bytes) to disk blocks; deprecated */ | |
85 | #define ctod(x) (x) /* XXX */ | |
86 | #define dtoc(x) (x) /* XXX */ | |
87 | #define dtob(x) ((x)<<PGSHIFT) /* XXX */ | |
88 | #endif SECSIZE | |
4c542963 SL |
89 | |
90 | /* clicks to bytes */ | |
91 | #define ctob(x) ((x)<<9) | |
92 | ||
93 | /* bytes to clicks */ | |
94 | #define btoc(x) ((((unsigned)(x)+511)>>9)) | |
95 | ||
dd94cc44 | 96 | #ifndef SECSIZE |
5e09dfcf MK |
97 | #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ |
98 | ((unsigned)(bytes) >> DEV_BSHIFT) | |
99 | #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ | |
100 | ((unsigned)(db) << DEV_BSHIFT) | |
101 | ||
102 | /* | |
103 | * Map a ``block device block'' to a file system block. | |
104 | * This should be device dependent, and will be if we | |
105 | * add an entry to cdevsw/bdevsw for that purpose. | |
106 | * For now though just use DEV_BSIZE. | |
107 | */ | |
108 | #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) | |
dd94cc44 MK |
109 | #else SECSIZE |
110 | /* bytes to "disk blocks" and back; deprecated */ | |
111 | #define btodb(bytes) ((unsigned)(bytes) >> DEV_BSHIFT) /* XXX */ | |
112 | #define dbtob(db) ((unsigned)(db) << DEV_BSHIFT) /* XXX */ | |
113 | #endif SECSIZE | |
5e09dfcf | 114 | |
4c542963 SL |
115 | /* |
116 | * Macros to decode processor status word. | |
117 | */ | |
118 | #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) | |
8664db0b | 119 | #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) |
4c542963 | 120 | |
3327052b MK |
121 | #ifdef KERNEL |
122 | #ifndef LOCORE | |
123 | int cpuspeed; | |
3327052b | 124 | #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } |
837583eb | 125 | #endif |
3327052b MK |
126 | |
127 | #else KERNEL | |
4c542963 | 128 | #define DELAY(n) { register int N = (n); while (--N > 0); } |
3327052b | 129 | #endif KERNEL |