xref: /csrg-svn/sys/vax/include/param.h (revision 30407)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)param.h	7.4 (Berkeley) 01/16/87
7  */
8 
9 /*
10  * Machine dependent constants for vax.
11  */
12 
13 #ifndef ENDIAN
14 /*
15  * Definitions for byte order,
16  * according to byte significance from low address to high.
17  */
18 #define	LITTLE	1234		/* least-significant byte first (vax) */
19 #define	BIG	4321		/* most-significant byte first */
20 #define	PDP	3412		/* LSB first in word, MSW first in long (pdp) */
21 #define	ENDIAN	LITTLE		/* byte order on vax */
22 
23 /*
24  * Macros for network/external number representation conversion.
25  */
26 #if ENDIAN == BIG && !defined(lint)
27 #define	ntohl(x)	(x)
28 #define	ntohs(x)	(x)
29 #define	htonl(x)	(x)
30 #define	htons(x)	(x)
31 #else
32 u_short	ntohs(), htons();
33 u_long	ntohl(), htonl();
34 #endif
35 
36 #define	NBPG		512		/* bytes/page */
37 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
38 #define	PGSHIFT		9		/* LOG2(NBPG) */
39 #define	NPTEPG		(NBPG/(sizeof (struct pte)))
40 
41 #define	DEV_BSIZE	512
42 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
43 #define BLKDEV_IOSIZE	2048
44 
45 #define	CLSIZE		2
46 #define	CLSIZELOG2	1
47 
48 #define	SSIZE		4		/* initial stack size/NBPG */
49 #define	SINCR		4		/* increment of stack/NBPG */
50 
51 #define	UPAGES		10		/* pages of u-area */
52 
53 /*
54  * Some macros for units conversion
55  */
56 /* Core clicks (512 bytes) to segments and vice versa */
57 #define	ctos(x)	(x)
58 #define	stoc(x)	(x)
59 
60 /* Core clicks (512 bytes) to disk blocks */
61 #define	ctod(x)	(x)
62 #define	dtoc(x)	(x)
63 #define	dtob(x)	((x)<<9)
64 
65 /* clicks to bytes */
66 #define	ctob(x)	((x)<<9)
67 
68 /* bytes to clicks */
69 #define	btoc(x)	((((unsigned)(x)+511)>>9))
70 
71 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
72 	((unsigned)(bytes) >> DEV_BSHIFT)
73 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
74 	((unsigned)(db) << DEV_BSHIFT)
75 
76 /*
77  * Map a ``block device block'' to a file system block.
78  * This should be device dependent, and will be if we
79  * add an entry to cdevsw/bdevsw for that purpose.
80  * For now though just use DEV_BSIZE.
81  */
82 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
83 
84 /*
85  * Macros to decode processor status word.
86  */
87 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
88 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
89 
90 #ifdef KERNEL
91 #ifndef LOCORE
92 int	cpuspeed;
93 #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
94 #endif
95 
96 #else KERNEL
97 #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
98 #endif KERNEL
99 #endif ENDIAN
100