xref: /csrg-svn/sys/tahoe/include/param.h (revision 25958)
1 /*	param.h	1.3	86/01/24	*/
2 
3 /*
4  * Machine dependent constants for TAHOE.
5  */
6 #define	NBPG	1024		/* bytes/page */
7 #define	PGOFSET	(NBPG-1)	/* byte offset into page */
8 #define	PGSHIFT	10		/* LOG2(NBPG) */
9 
10 #define	CLSIZE		1
11 #define	CLSIZELOG2	0
12 
13 #define	SSIZE	2			/* initial stack size/NBPG */
14 #define	SINCR	2			/* increment of stack/NBPG */
15 #define	UPAGES	6			/* pages of u-area (2 stack pages) */
16 
17 #define	MAXCKEY	255		/* maximal allowed code key */
18 #define	MAXDKEY	255		/* maximal allowed data key */
19 #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
20 #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
21 
22 /*
23  * Statistics maintained for code and
24  * data cache key allocations algorithms.
25  */
26 struct	keystats {
27 	long	ks_allocs;	/* number of keys allocated */
28 	long	ks_free;	/* key allocated from free slot */
29 	long	ks_norefs;	/* key marked in use, but refcnt 0 */
30 	long	ks_taken;	/* key taken from single process */
31 	long	ks_shared;	/* key taken from multiple processes */
32 };
33 
34 /*
35  * Some macros for units conversion
36  */
37 /* Core clicks (1024 bytes) to segments and vice versa */
38 #define	ctos(x)	(x)
39 #define	stoc(x)	(x)
40 
41 /* Core clicks (1024 bytes) to disk blocks */
42 #define	ctod(x)	(x)
43 #define	dtoc(x)	(x)
44 #define	dtob(x)	((x)<<PGSHIFT)
45 
46 /* clicks to bytes */
47 #define	ctob(x)	((x)<<PGSHIFT)
48 
49 /* bytes to clicks */
50 #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
51 
52 /*
53  * Macros to decode processor status word.
54  */
55 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
56 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
57 
58 #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
59