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