mv machdep to machparam.h
[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 *
5e09dfcf 6 * @(#)param.h 7.4 (Berkeley) %G%
da7c5cc6 7 */
4c542963
SL
8
9/*
10 * Machine dependent constants for vax.
11 */
837583eb
MK
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
b410e761
MK
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
32u_short ntohs(), htons();
33u_long ntohl(), htonl();
34#endif
35
5e09dfcf
MK
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
4c542963
SL
44
45#define CLSIZE 2
46#define CLSIZELOG2 1
47
5e09dfcf
MK
48#define SSIZE 4 /* initial stack size/NBPG */
49#define SINCR 4 /* increment of stack/NBPG */
4c542963 50
5e09dfcf 51#define UPAGES 10 /* pages of u-area */
4c542963
SL
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
5e09dfcf
MK
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
4c542963
SL
84/*
85 * Macros to decode processor status word.
86 */
87#define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD)
8664db0b 88#define BASEPRI(ps) (((ps) & PSL_IPL) == 0)
4c542963 89
3327052b
MK
90#ifdef KERNEL
91#ifndef LOCORE
92int cpuspeed;
3327052b 93#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
837583eb 94#endif
3327052b
MK
95
96#else KERNEL
4c542963 97#define DELAY(n) { register int N = (n); while (--N > 0); }
3327052b 98#endif KERNEL
b410e761 99#endif ENDIAN