xref: /csrg-svn/sys/tahoe/include/param.h (revision 30402)
1 /*	param.h	1.5	87/01/16	*/
2 
3 /*
4  * Machine dependent constants for TAHOE.
5  */
6 
7 #ifndef ENDIAN
8 /*
9  * Definitions for byte order,
10  * according to byte significance from low address to high.
11  */
12 #define	LITTLE	1234		/* least-significant byte first (vax) */
13 #define	BIG	4321		/* most-significant byte first */
14 #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
15 #define	ENDIAN	BIG		/* byte order on tahoe */
16 
17 /*
18  * Macros for network/external number representation conversion.
19  */
20 #if ENDIAN == BIG && !defined(lint)
21 #define	ntohl(x)	(x)
22 #define	ntohs(x)	(x)
23 #define	htonl(x)	(x)
24 #define	htons(x)	(x)
25 #else
26 u_short	ntohs(), htons();
27 u_long	ntohl(), htonl();
28 #endif
29 
30 #define	NBPG	1024		/* bytes/page */
31 #define	PGOFSET	(NBPG-1)	/* byte offset into page */
32 #define	PGSHIFT	10		/* LOG2(NBPG) */
33 
34 #define	CLSIZE		1
35 #define	CLSIZELOG2	0
36 
37 #define	SSIZE	2			/* initial stack size/NBPG */
38 #define	SINCR	2			/* increment of stack/NBPG */
39 #define	UPAGES	6			/* pages of u-area (2 stack pages) */
40 
41 #define	MAXCKEY	255		/* maximal allowed code key */
42 #define	MAXDKEY	255		/* maximal allowed data key */
43 #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
44 #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
45 
46 /*
47  * Some macros for units conversion
48  */
49 /* Core clicks (1024 bytes) to segments and vice versa */
50 #define	ctos(x)	(x)
51 #define	stoc(x)	(x)
52 
53 /* Core clicks (1024 bytes) to disk blocks */
54 #define	ctod(x)	(x)
55 #define	dtoc(x)	(x)
56 #define	dtob(x)	((x)<<PGSHIFT)
57 
58 /* clicks to bytes */
59 #define	ctob(x)	((x)<<PGSHIFT)
60 
61 /* bytes to clicks */
62 #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
63 
64 /*
65  * Macros to decode processor status word.
66  */
67 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
68 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
69 
70 #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
71 #endif
72