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