xref: /csrg-svn/sys/tahoe/include/param.h (revision 34408)
133282Skarels /*
2*34408Skarels  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
333282Skarels  * All rights reserved.  The Berkeley software License Agreement
433282Skarels  * specifies the terms and conditions for redistribution.
533282Skarels  *
6*34408Skarels  *	@(#)param.h	7.1 (Berkeley) 05/21/88
733282Skarels  */
825681Ssam 
925681Ssam /*
1025681Ssam  * Machine dependent constants for TAHOE.
1125681Ssam  */
1231163Sbostic #define	MACHINE	"tahoe"
1331163Sbostic 
1433380Skarels #ifndef BYTE_ORDER
1533282Skarels #include <machine/endian.h>
1633282Skarels #endif
1733282Skarels 
1832564Sbostic #define	CHAR_BIT	NBBY
1932564Sbostic #define	CHAR_MAX	0x7f
2032564Sbostic #define	CHAR_MIN	0x80
2133282Skarels #define	CLK_TCK		60			/* for times() */
2232564Sbostic #define	INT_MAX		0x7fffffff
2332564Sbostic #define	INT_MIN		0x80000000
2432564Sbostic #define	LONG_MAX	0x7fffffff
2532564Sbostic #define	LONG_MIN	0x80000000
2632564Sbostic #define	SCHAR_MAX	0x7f
2732564Sbostic #define	SCHAR_MIN	0x80
2832564Sbostic #define	SHRT_MAX	0x7fff
2932564Sbostic #define	SHRT_MIN	0x8000
3032564Sbostic #define	UCHAR_MAX	0xff
3132564Sbostic #define	UINT_MAX	0xffffffff
3232564Sbostic #define	ULONG_MAX	0xffffffff
3332564Sbostic #define	USHRT_MAX	0xffff
3432564Sbostic 
3530407Skarels #define	NBPG		1024		/* bytes/page */
3630407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
3730407Skarels #define	PGSHIFT		10		/* LOG2(NBPG) */
3830407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
3925681Ssam 
4030752Skarels #define	KERNBASE	0xc0000000	/* start of kernel virtual */
4130752Skarels #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
4230752Skarels 
4330407Skarels #define	DEV_BSIZE	1024
4430407Skarels #define	DEV_BSHIFT	10		/* log2(DEV_BSIZE) */
4530407Skarels #define BLKDEV_IOSIZE	1024		/* NBPG for physical controllers */
4630752Skarels #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
4730407Skarels 
4825681Ssam #define	CLSIZE		1
4925681Ssam #define	CLSIZELOG2	0
5025681Ssam 
5130407Skarels #define	SSIZE		2		/* initial stack size/NBPG */
5230407Skarels #define	SINCR		2		/* increment of stack/NBPG */
5330407Skarels #define	UPAGES		6		/* pages of u-area (2 stack pages) */
5425681Ssam 
5525681Ssam #define	MAXCKEY	255		/* maximal allowed code key */
5625681Ssam #define	MAXDKEY	255		/* maximal allowed data key */
5725681Ssam #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
5825681Ssam #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
5925681Ssam 
6025681Ssam /*
6125681Ssam  * Some macros for units conversion
6225681Ssam  */
6325681Ssam /* Core clicks (1024 bytes) to segments and vice versa */
6425681Ssam #define	ctos(x)	(x)
6525681Ssam #define	stoc(x)	(x)
6625681Ssam 
6725681Ssam /* Core clicks (1024 bytes) to disk blocks */
6825681Ssam #define	ctod(x)	(x)
6925681Ssam #define	dtoc(x)	(x)
7025681Ssam #define	dtob(x)	((x)<<PGSHIFT)
7125681Ssam 
7225681Ssam /* clicks to bytes */
7325681Ssam #define	ctob(x)	((x)<<PGSHIFT)
7425681Ssam 
7525681Ssam /* bytes to clicks */
7625681Ssam #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
7725681Ssam 
7830407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
7930407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
8030407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
8130407Skarels 	((unsigned)(db) << DEV_BSHIFT)
8230407Skarels 
8325681Ssam /*
8430407Skarels  * Map a ``block device block'' to a file system block.
8530407Skarels  * This should be device dependent, and will be if we
8630407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
8730407Skarels  * For now though just use DEV_BSIZE.
8830407Skarels  */
8930407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
9030407Skarels 
9130407Skarels /*
9225681Ssam  * Macros to decode processor status word.
9325681Ssam  */
9425681Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
9525681Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
9625681Ssam 
9725681Ssam #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
98