date and time created 88/01/07 10:56:23 by bostic
[unix-history] / usr / src / sys / vax / include / param.h
CommitLineData
da7c5cc6 1/*
0880b18e 2 * Copyright (c) 1982, 1986 Regents of the University of California.
da7c5cc6
KM
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
153bfc58 6 * @(#)param.h 7.8 (Berkeley) %G%
da7c5cc6 7 */
4c542963 8
153bfc58 9#ifndef ENDIAN
4c542963
SL
10/*
11 * Machine dependent constants for vax.
12 */
49c8d125
KB
13#define MACHINE "vax"
14
153bfc58
KB
15#define CHAR_BIT NBBY
16#define CHAR_MAX 0x7f
17#define CHAR_MIN 0x80
18#define CLK_TCK UNDEFINED_FOR_NOW
19#define INT_MAX 0x7fffffff
20#define INT_MIN 0x80000000
21#define LONG_MAX 0x7fffffff
22#define LONG_MIN 0x80000000
23#define SCHAR_MAX 0x7f
24#define SCHAR_MIN 0x80
25#define SHRT_MAX 0x7fff
26#define SHRT_MIN 0x8000
27#define UCHAR_MAX 0xff
28#define UINT_MAX 0xffffffff
29#define ULONG_MAX 0xffffffff
30#define USHRT_MAX 0xffff
31
837583eb
MK
32/*
33 * Definitions for byte order,
34 * according to byte significance from low address to high.
35 */
36#define LITTLE 1234 /* least-significant byte first (vax) */
37#define BIG 4321 /* most-significant byte first */
38#define PDP 3412 /* LSB first in word, MSW first in long (pdp) */
39#define ENDIAN LITTLE /* byte order on vax */
40
b410e761
MK
41/*
42 * Macros for network/external number representation conversion.
43 */
44#if ENDIAN == BIG && !defined(lint)
45#define ntohl(x) (x)
46#define ntohs(x) (x)
47#define htonl(x) (x)
48#define htons(x) (x)
49#else
abdbcafc
MK
50unsigned short ntohs(), htons();
51unsigned long ntohl(), htonl();
b410e761
MK
52#endif
53
dd94cc44
MK
54#define KERNBASE 0x80000000 /* start of kernel virtual */
55#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
56
58b14b46
MK
57#define KERNBASE 0x80000000 /* start of kernel virtual */
58#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
59
5e09dfcf
MK
60#define NBPG 512 /* bytes/page */
61#define PGOFSET (NBPG-1) /* byte offset into page */
62#define PGSHIFT 9 /* LOG2(NBPG) */
63#define NPTEPG (NBPG/(sizeof (struct pte)))
64
dd94cc44 65#ifndef SECSIZE
5e09dfcf
MK
66#define DEV_BSIZE 512
67#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
68#define BLKDEV_IOSIZE 2048
58b14b46 69#define MAXPHYS (63 * 1024) /* max raw I/O transfer size */
dd94cc44
MK
70#else SECSIZE
71/*
72 * Devices without disk labels and the swap virtual device
73 * use "blocks" of exactly pagesize. Devices with disk labels
74 * use device-dependent sector sizes for block and character interfaces.
75 */
76#define DEV_BSIZE NBPG
77#define DEV_BSHIFT PGSHIFT /* log2(DEV_BSIZE) */
78#define BLKDEV_IOSIZE NBPG /* NBPG for unlabeled block devices */
79#endif SECSIZE
80#define MAXPHYS (63 * 1024) /* max raw I/O transfer size */
4c542963
SL
81
82#define CLSIZE 2
83#define CLSIZELOG2 1
84
5e09dfcf
MK
85#define SSIZE 4 /* initial stack size/NBPG */
86#define SINCR 4 /* increment of stack/NBPG */
4c542963 87
5e09dfcf 88#define UPAGES 10 /* pages of u-area */
4c542963
SL
89
90/*
91 * Some macros for units conversion
92 */
93/* Core clicks (512 bytes) to segments and vice versa */
94#define ctos(x) (x)
95#define stoc(x) (x)
96
dd94cc44 97#ifndef SECSIZE
4c542963
SL
98/* Core clicks (512 bytes) to disk blocks */
99#define ctod(x) (x)
100#define dtoc(x) (x)
dd94cc44
MK
101#define dtob(x) ((x)<<PGSHIFT)
102#else SECSIZE
103/* Core clicks (512 bytes) to disk blocks; deprecated */
104#define ctod(x) (x) /* XXX */
105#define dtoc(x) (x) /* XXX */
106#define dtob(x) ((x)<<PGSHIFT) /* XXX */
107#endif SECSIZE
4c542963
SL
108
109/* clicks to bytes */
110#define ctob(x) ((x)<<9)
111
112/* bytes to clicks */
113#define btoc(x) ((((unsigned)(x)+511)>>9))
114
dd94cc44 115#ifndef SECSIZE
5e09dfcf
MK
116#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
117 ((unsigned)(bytes) >> DEV_BSHIFT)
118#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
119 ((unsigned)(db) << DEV_BSHIFT)
120
121/*
122 * Map a ``block device block'' to a file system block.
123 * This should be device dependent, and will be if we
124 * add an entry to cdevsw/bdevsw for that purpose.
125 * For now though just use DEV_BSIZE.
126 */
127#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
dd94cc44
MK
128#else SECSIZE
129/* bytes to "disk blocks" and back; deprecated */
130#define btodb(bytes) ((unsigned)(bytes) >> DEV_BSHIFT) /* XXX */
131#define dbtob(db) ((unsigned)(db) << DEV_BSHIFT) /* XXX */
132#endif SECSIZE
5e09dfcf 133
4c542963
SL
134/*
135 * Macros to decode processor status word.
136 */
137#define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD)
8664db0b 138#define BASEPRI(ps) (((ps) & PSL_IPL) == 0)
4c542963 139
3327052b
MK
140#ifdef KERNEL
141#ifndef LOCORE
142int cpuspeed;
3327052b 143#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
837583eb 144#endif
3327052b
MK
145
146#else KERNEL
4c542963 147#define DELAY(n) { register int N = (n); while (--N > 0); }
3327052b 148#endif KERNEL
b410e761 149#endif ENDIAN