xref: /original-bsd/sys/tahoe/include/param.h (revision 92c664ec)
1 /*	param.h	1.10	87/10/28	*/
2 
3 #ifndef ENDIAN
4 /*
5  * Machine dependent constants for TAHOE.
6  */
7 #define	MACHINE	"tahoe"
8 
9 #define	CHAR_BIT	NBBY
10 #define	CHAR_MAX	0x7f
11 #define	CHAR_MIN	0x80
12 #define	CLK_TCK		UNDEFINED_FOR_NOW
13 #define	INT_MAX		0x7fffffff
14 #define	INT_MIN		0x80000000
15 #define	LONG_MAX	0x7fffffff
16 #define	LONG_MIN	0x80000000
17 #define	SCHAR_MAX	0x7f
18 #define	SCHAR_MIN	0x80
19 #define	SHRT_MAX	0x7fff
20 #define	SHRT_MIN	0x8000
21 #define	UCHAR_MAX	0xff
22 #define	UINT_MAX	0xffffffff
23 #define	ULONG_MAX	0xffffffff
24 #define	USHRT_MAX	0xffff
25 
26 /*
27  * Definitions for byte order,
28  * according to byte significance from low address to high.
29  */
30 #define	LITTLE	1234		/* least-significant byte first (vax) */
31 #define	BIG	4321		/* most-significant byte first */
32 #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
33 #define	ENDIAN	BIG		/* byte order on tahoe */
34 
35 /*
36  * Macros for network/external number representation conversion.
37  */
38 #if ENDIAN == BIG && !defined(lint)
39 #define	ntohl(x)	(x)
40 #define	ntohs(x)	(x)
41 #define	htonl(x)	(x)
42 #define	htons(x)	(x)
43 #else
44 unsigned short	ntohs(), htons();
45 unsigned long	ntohl(), htonl();
46 #endif
47 
48 #define	NBPG		1024		/* bytes/page */
49 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
50 #define	PGSHIFT		10		/* LOG2(NBPG) */
51 #define	NPTEPG		(NBPG/(sizeof (struct pte)))
52 
53 #define	KERNBASE	0xc0000000	/* start of kernel virtual */
54 #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
55 
56 #define	DEV_BSIZE	1024
57 #define	DEV_BSHIFT	10		/* log2(DEV_BSIZE) */
58 #define BLKDEV_IOSIZE	1024		/* NBPG for physical controllers */
59 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
60 
61 #define	CLSIZE		1
62 #define	CLSIZELOG2	0
63 
64 #define	SSIZE		2		/* initial stack size/NBPG */
65 #define	SINCR		2		/* increment of stack/NBPG */
66 #define	UPAGES		6		/* pages of u-area (2 stack pages) */
67 
68 #define	MAXCKEY	255		/* maximal allowed code key */
69 #define	MAXDKEY	255		/* maximal allowed data key */
70 #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
71 #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
72 
73 /*
74  * Some macros for units conversion
75  */
76 /* Core clicks (1024 bytes) to segments and vice versa */
77 #define	ctos(x)	(x)
78 #define	stoc(x)	(x)
79 
80 /* Core clicks (1024 bytes) to disk blocks */
81 #define	ctod(x)	(x)
82 #define	dtoc(x)	(x)
83 #define	dtob(x)	((x)<<PGSHIFT)
84 
85 /* clicks to bytes */
86 #define	ctob(x)	((x)<<PGSHIFT)
87 
88 /* bytes to clicks */
89 #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
90 
91 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
92 	((unsigned)(bytes) >> DEV_BSHIFT)
93 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
94 	((unsigned)(db) << DEV_BSHIFT)
95 
96 /*
97  * Map a ``block device block'' to a file system block.
98  * This should be device dependent, and will be if we
99  * add an entry to cdevsw/bdevsw for that purpose.
100  * For now though just use DEV_BSIZE.
101  */
102 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
103 
104 /*
105  * Macros to decode processor status word.
106  */
107 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
108 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
109 
110 #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
111 #endif
112