xref: /original-bsd/sys/tahoe/include/param.h (revision b898f5cc)
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  *	@(#)param.h	1.12 (Berkeley) 01/21/88
7  */
8 
9 /*
10  * Machine dependent constants for TAHOE.
11  */
12 #define	MACHINE	"tahoe"
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		1024		/* bytes/page */
36 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
37 #define	PGSHIFT		10		/* LOG2(NBPG) */
38 #define	NPTEPG		(NBPG/(sizeof (struct pte)))
39 
40 #define	KERNBASE	0xc0000000	/* start of kernel virtual */
41 #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
42 
43 #define	DEV_BSIZE	1024
44 #define	DEV_BSHIFT	10		/* log2(DEV_BSIZE) */
45 #define BLKDEV_IOSIZE	1024		/* NBPG for physical controllers */
46 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
47 
48 #define	CLSIZE		1
49 #define	CLSIZELOG2	0
50 
51 #define	SSIZE		2		/* initial stack size/NBPG */
52 #define	SINCR		2		/* increment of stack/NBPG */
53 #define	UPAGES		6		/* pages of u-area (2 stack pages) */
54 
55 #define	MAXCKEY	255		/* maximal allowed code key */
56 #define	MAXDKEY	255		/* maximal allowed data key */
57 #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
58 #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
59 
60 /*
61  * Some macros for units conversion
62  */
63 /* Core clicks (1024 bytes) to segments and vice versa */
64 #define	ctos(x)	(x)
65 #define	stoc(x)	(x)
66 
67 /* Core clicks (1024 bytes) to disk blocks */
68 #define	ctod(x)	(x)
69 #define	dtoc(x)	(x)
70 #define	dtob(x)	((x)<<PGSHIFT)
71 
72 /* clicks to bytes */
73 #define	ctob(x)	((x)<<PGSHIFT)
74 
75 /* bytes to clicks */
76 #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
77 
78 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
79 	((unsigned)(bytes) >> DEV_BSHIFT)
80 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
81 	((unsigned)(db) << DEV_BSHIFT)
82 
83 /*
84  * Map a ``block device block'' to a file system block.
85  * This should be device dependent, and will be if we
86  * add an entry to cdevsw/bdevsw for that purpose.
87  * For now though just use DEV_BSIZE.
88  */
89 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
90 
91 /*
92  * Macros to decode processor status word.
93  */
94 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
95 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
96 
97 #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
98