|
|
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.10 (Berkeley) 1/21/88
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: #define CHAR_BIT NBBY
19: #define CHAR_MAX 0x7f
20: #define CHAR_MIN 0x80
21: #define CLK_TCK 60 /* for times() */
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:
35: #define NBPG 512 /* bytes/page */
36: #define PGOFSET (NBPG-1) /* byte offset into page */
37: #define PGSHIFT 9 /* LOG2(NBPG) */
38: #define NPTEPG (NBPG/(sizeof (struct pte)))
39:
40: #define KERNBASE 0x80000000 /* start of kernel virtual */
41: #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
42:
43: #define DEV_BSIZE 512
44: #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
45: #define BLKDEV_IOSIZE 2048
46: #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */
47:
48: #define CLSIZE 2
49: #define CLSIZELOG2 1
50:
51: #define SSIZE 4 /* initial stack size/NBPG */
52: #define SINCR 4 /* increment of stack/NBPG */
53:
54: #define UPAGES 10 /* pages of u-area */
55:
56: /*
57: * Some macros for units conversion
58: */
59: /* Core clicks (512 bytes) to segments and vice versa */
60: #define ctos(x) (x)
61: #define stoc(x) (x)
62:
63: /* Core clicks (512 bytes) to disk blocks */
64: #define ctod(x) (x)
65: #define dtoc(x) (x)
66: #define dtob(x) ((x)<<PGSHIFT)
67:
68: /* clicks to bytes */
69: #define ctob(x) ((x)<<9)
70:
71: /* bytes to clicks */
72: #define btoc(x) ((((unsigned)(x)+511)>>9))
73:
74: #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
75: ((unsigned)(bytes) >> DEV_BSHIFT)
76: #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
77: ((unsigned)(db) << DEV_BSHIFT)
78:
79: /*
80: * Map a ``block device block'' to a file system block.
81: * This should be device dependent, and will be if we
82: * add an entry to cdevsw/bdevsw for that purpose.
83: * For now though just use DEV_BSIZE.
84: */
85: #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
86:
87: /*
88: * Macros to decode processor status word.
89: */
90: #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD)
91: #define BASEPRI(ps) (((ps) & PSL_IPL) == 0)
92:
93: #ifdef KERNEL
94: #ifndef LOCORE
95: int cpuspeed;
96: #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
97: #endif
98:
99: #else KERNEL
100: #define DELAY(n) { register int N = (n); while (--N > 0); }
101: #endif KERNEL
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.