xref: /csrg-svn/sys/vax/include/param.h (revision 32563)
123264Smckusick /*
229186Smckusick  * Copyright (c) 1982, 1986 Regents of the University of California.
323264Smckusick  * All rights reserved.  The Berkeley software License Agreement
423264Smckusick  * specifies the terms and conditions for redistribution.
523264Smckusick  *
6*32563Sbostic  *	@(#)param.h	7.8 (Berkeley) 10/28/87
723264Smckusick  */
89118Ssam 
9*32563Sbostic #ifndef ENDIAN
109118Ssam /*
119118Ssam  * Machine dependent constants for vax.
129118Ssam  */
1331162Sbostic #define	MACHINE	"vax"
1431162Sbostic 
15*32563Sbostic #define	CHAR_BIT	NBBY
16*32563Sbostic #define	CHAR_MAX	0x7f
17*32563Sbostic #define	CHAR_MIN	0x80
18*32563Sbostic #define	CLK_TCK		UNDEFINED_FOR_NOW
19*32563Sbostic #define	INT_MAX		0x7fffffff
20*32563Sbostic #define	INT_MIN		0x80000000
21*32563Sbostic #define	LONG_MAX	0x7fffffff
22*32563Sbostic #define	LONG_MIN	0x80000000
23*32563Sbostic #define	SCHAR_MAX	0x7f
24*32563Sbostic #define	SCHAR_MIN	0x80
25*32563Sbostic #define	SHRT_MAX	0x7fff
26*32563Sbostic #define	SHRT_MIN	0x8000
27*32563Sbostic #define	UCHAR_MAX	0xff
28*32563Sbostic #define	UINT_MAX	0xffffffff
29*32563Sbostic #define	ULONG_MAX	0xffffffff
30*32563Sbostic #define	USHRT_MAX	0xffff
31*32563Sbostic 
3229953Skarels /*
3329953Skarels  * Definitions for byte order,
3429953Skarels  * according to byte significance from low address to high.
3529953Skarels  */
3629953Skarels #define	LITTLE	1234		/* least-significant byte first (vax) */
3729953Skarels #define	BIG	4321		/* most-significant byte first */
3829953Skarels #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
3929953Skarels #define	ENDIAN	LITTLE		/* byte order on vax */
4029953Skarels 
4130403Skarels /*
4230403Skarels  * Macros for network/external number representation conversion.
4330403Skarels  */
4430403Skarels #if ENDIAN == BIG && !defined(lint)
4530403Skarels #define	ntohl(x)	(x)
4630403Skarels #define	ntohs(x)	(x)
4730403Skarels #define	htonl(x)	(x)
4830403Skarels #define	htons(x)	(x)
4930403Skarels #else
5031108Skarels unsigned short	ntohs(), htons();
5131108Skarels unsigned long	ntohl(), htonl();
5230403Skarels #endif
5330403Skarels 
5430766Skarels #define	KERNBASE	0x80000000	/* start of kernel virtual */
5530766Skarels #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
5630766Skarels 
5730407Skarels #define	NBPG		512		/* bytes/page */
5830407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
5930407Skarels #define	PGSHIFT		9		/* LOG2(NBPG) */
6030407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
619118Ssam 
6230407Skarels #define	DEV_BSIZE	512
6330407Skarels #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
6430407Skarels #define BLKDEV_IOSIZE	2048
6530766Skarels #define	MAXPHYS		(63 * 1024)	/* max raw I/O transfer size */
6630407Skarels 
679118Ssam #define	CLSIZE		2
689118Ssam #define	CLSIZELOG2	1
699118Ssam 
7030407Skarels #define	SSIZE		4		/* initial stack size/NBPG */
7130407Skarels #define	SINCR		4		/* increment of stack/NBPG */
729118Ssam 
7330407Skarels #define	UPAGES		10		/* pages of u-area */
749118Ssam 
759118Ssam /*
769118Ssam  * Some macros for units conversion
779118Ssam  */
789118Ssam /* Core clicks (512 bytes) to segments and vice versa */
799118Ssam #define	ctos(x)	(x)
809118Ssam #define	stoc(x)	(x)
819118Ssam 
829118Ssam /* Core clicks (512 bytes) to disk blocks */
839118Ssam #define	ctod(x)	(x)
849118Ssam #define	dtoc(x)	(x)
8530766Skarels #define	dtob(x)	((x)<<PGSHIFT)
869118Ssam 
879118Ssam /* clicks to bytes */
889118Ssam #define	ctob(x)	((x)<<9)
899118Ssam 
909118Ssam /* bytes to clicks */
919118Ssam #define	btoc(x)	((((unsigned)(x)+511)>>9))
929118Ssam 
9330407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
9430407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
9530407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
9630407Skarels 	((unsigned)(db) << DEV_BSHIFT)
9730407Skarels 
989118Ssam /*
9930407Skarels  * Map a ``block device block'' to a file system block.
10030407Skarels  * This should be device dependent, and will be if we
10130407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
10230407Skarels  * For now though just use DEV_BSIZE.
10330407Skarels  */
10430407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
10530407Skarels 
10630407Skarels /*
1079118Ssam  * Macros to decode processor status word.
1089118Ssam  */
1099118Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
1109600Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
1119118Ssam 
11224887Skarels #ifdef KERNEL
11324887Skarels #ifndef LOCORE
11424887Skarels int	cpuspeed;
11529953Skarels #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
11624887Skarels #endif
11724887Skarels 
11824887Skarels #else KERNEL
1199118Ssam #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
12024887Skarels #endif KERNEL
12130403Skarels #endif ENDIAN
122