xref: /csrg-svn/sys/tahoe/include/param.h (revision 30402)
1*30402Skarels /*	param.h	1.5	87/01/16	*/
225681Ssam 
325681Ssam /*
425681Ssam  * Machine dependent constants for TAHOE.
525681Ssam  */
629950Skarels 
729950Skarels #ifndef ENDIAN
829950Skarels /*
929950Skarels  * Definitions for byte order,
1029950Skarels  * according to byte significance from low address to high.
1129950Skarels  */
1229950Skarels #define	LITTLE	1234		/* least-significant byte first (vax) */
1329950Skarels #define	BIG	4321		/* most-significant byte first */
1429950Skarels #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
1529950Skarels #define	ENDIAN	BIG		/* byte order on tahoe */
1629950Skarels 
17*30402Skarels /*
18*30402Skarels  * Macros for network/external number representation conversion.
19*30402Skarels  */
20*30402Skarels #if ENDIAN == BIG && !defined(lint)
21*30402Skarels #define	ntohl(x)	(x)
22*30402Skarels #define	ntohs(x)	(x)
23*30402Skarels #define	htonl(x)	(x)
24*30402Skarels #define	htons(x)	(x)
25*30402Skarels #else
26*30402Skarels u_short	ntohs(), htons();
27*30402Skarels u_long	ntohl(), htonl();
28*30402Skarels #endif
29*30402Skarels 
3025681Ssam #define	NBPG	1024		/* bytes/page */
3125681Ssam #define	PGOFSET	(NBPG-1)	/* byte offset into page */
3225681Ssam #define	PGSHIFT	10		/* LOG2(NBPG) */
3325681Ssam 
3425681Ssam #define	CLSIZE		1
3525681Ssam #define	CLSIZELOG2	0
3625681Ssam 
3725681Ssam #define	SSIZE	2			/* initial stack size/NBPG */
3825681Ssam #define	SINCR	2			/* increment of stack/NBPG */
3925681Ssam #define	UPAGES	6			/* pages of u-area (2 stack pages) */
4025681Ssam 
4125681Ssam #define	MAXCKEY	255		/* maximal allowed code key */
4225681Ssam #define	MAXDKEY	255		/* maximal allowed data key */
4325681Ssam #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
4425681Ssam #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
4525681Ssam 
4625681Ssam /*
4725681Ssam  * Some macros for units conversion
4825681Ssam  */
4925681Ssam /* Core clicks (1024 bytes) to segments and vice versa */
5025681Ssam #define	ctos(x)	(x)
5125681Ssam #define	stoc(x)	(x)
5225681Ssam 
5325681Ssam /* Core clicks (1024 bytes) to disk blocks */
5425681Ssam #define	ctod(x)	(x)
5525681Ssam #define	dtoc(x)	(x)
5625681Ssam #define	dtob(x)	((x)<<PGSHIFT)
5725681Ssam 
5825681Ssam /* clicks to bytes */
5925681Ssam #define	ctob(x)	((x)<<PGSHIFT)
6025681Ssam 
6125681Ssam /* bytes to clicks */
6225681Ssam #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
6325681Ssam 
6425681Ssam /*
6525681Ssam  * Macros to decode processor status word.
6625681Ssam  */
6725681Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
6825681Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
6925681Ssam 
7025681Ssam #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
7129950Skarels #endif
72