xref: /csrg-svn/sys/tahoe/include/param.h (revision 31163)
1*31163Sbostic /*	param.h	1.9	87/05/21	*/
225681Ssam 
325681Ssam /*
425681Ssam  * Machine dependent constants for TAHOE.
525681Ssam  */
629950Skarels 
7*31163Sbostic #define	MACHINE	"tahoe"
8*31163Sbostic 
929950Skarels #ifndef ENDIAN
1029950Skarels /*
1129950Skarels  * Definitions for byte order,
1229950Skarels  * according to byte significance from low address to high.
1329950Skarels  */
1429950Skarels #define	LITTLE	1234		/* least-significant byte first (vax) */
1529950Skarels #define	BIG	4321		/* most-significant byte first */
1629950Skarels #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
1729950Skarels #define	ENDIAN	BIG		/* byte order on tahoe */
1829950Skarels 
1930402Skarels /*
2030402Skarels  * Macros for network/external number representation conversion.
2130402Skarels  */
2230402Skarels #if ENDIAN == BIG && !defined(lint)
2330402Skarels #define	ntohl(x)	(x)
2430402Skarels #define	ntohs(x)	(x)
2530402Skarels #define	htonl(x)	(x)
2630402Skarels #define	htons(x)	(x)
2730402Skarels #else
2831107Skarels unsigned short	ntohs(), htons();
2931107Skarels unsigned long	ntohl(), htonl();
3030402Skarels #endif
3130402Skarels 
3230407Skarels #define	NBPG		1024		/* bytes/page */
3330407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
3430407Skarels #define	PGSHIFT		10		/* LOG2(NBPG) */
3530407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
3625681Ssam 
3730752Skarels #define	KERNBASE	0xc0000000	/* start of kernel virtual */
3830752Skarels #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
3930752Skarels 
4030407Skarels #define	DEV_BSIZE	1024
4130407Skarels #define	DEV_BSHIFT	10		/* log2(DEV_BSIZE) */
4230407Skarels #define BLKDEV_IOSIZE	1024		/* NBPG for physical controllers */
4330752Skarels #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
4430407Skarels 
4525681Ssam #define	CLSIZE		1
4625681Ssam #define	CLSIZELOG2	0
4725681Ssam 
4830407Skarels #define	SSIZE		2		/* initial stack size/NBPG */
4930407Skarels #define	SINCR		2		/* increment of stack/NBPG */
5030407Skarels #define	UPAGES		6		/* pages of u-area (2 stack pages) */
5125681Ssam 
5225681Ssam #define	MAXCKEY	255		/* maximal allowed code key */
5325681Ssam #define	MAXDKEY	255		/* maximal allowed data key */
5425681Ssam #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
5525681Ssam #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
5625681Ssam 
5725681Ssam /*
5825681Ssam  * Some macros for units conversion
5925681Ssam  */
6025681Ssam /* Core clicks (1024 bytes) to segments and vice versa */
6125681Ssam #define	ctos(x)	(x)
6225681Ssam #define	stoc(x)	(x)
6325681Ssam 
6425681Ssam /* Core clicks (1024 bytes) to disk blocks */
6525681Ssam #define	ctod(x)	(x)
6625681Ssam #define	dtoc(x)	(x)
6725681Ssam #define	dtob(x)	((x)<<PGSHIFT)
6825681Ssam 
6925681Ssam /* clicks to bytes */
7025681Ssam #define	ctob(x)	((x)<<PGSHIFT)
7125681Ssam 
7225681Ssam /* bytes to clicks */
7325681Ssam #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
7425681Ssam 
7530407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
7630407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
7730407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
7830407Skarels 	((unsigned)(db) << DEV_BSHIFT)
7930407Skarels 
8025681Ssam /*
8130407Skarels  * Map a ``block device block'' to a file system block.
8230407Skarels  * This should be device dependent, and will be if we
8330407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
8430407Skarels  * For now though just use DEV_BSIZE.
8530407Skarels  */
8630407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
8730407Skarels 
8830407Skarels /*
8925681Ssam  * Macros to decode processor status word.
9025681Ssam  */
9125681Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
9225681Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
9325681Ssam 
9425681Ssam #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
9529950Skarels #endif
96